Last set of CW Pro 5 projects (probably)
[python/dscho.git] / Python / getmtime.c
blob8bae191505af7a577f73ffecf239bd239614e22a
1 /***********************************************************
2 Copyright (c) 2000, BeOpen.com.
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5 All rights reserved.
7 See the file "Misc/COPYRIGHT" for information on usage and
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9 ******************************************************************/
11 /* Subroutine to get the last modification time of a file */
13 /* (A separate file because this may be OS dependent) */
15 #include "Python.h"
16 #include "config.h"
18 #include <stdio.h>
19 #ifndef DONT_HAVE_SYS_TYPES_H
20 #include <sys/types.h>
21 #endif
22 #ifndef DONT_HAVE_SYS_STAT_H
23 #include <sys/stat.h>
24 #elif defined(HAVE_STAT_H)
25 #include <stat.h>
26 #endif
28 time_t
29 PyOS_GetLastModificationTime(char *path, FILE *fp)
31 struct stat st;
32 if (fstat(fileno(fp), &st) != 0)
33 return -1;
34 else
35 return st.st_mtime;