Guido van Rossum | be0e942 | 1993-12-24 10:32:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* Subroutine to get the last modification time of a file */ |
| 3 | |
| 4 | /* (A separate file because this may be OS dependent) */ |
| 5 | |
Fred Drake | 4c82b23 | 2000-06-30 16:18:57 +0000 | [diff] [blame] | 6 | #include "Python.h" |
Martin v. Löwis | 4f1cd8b | 2001-07-26 13:41:06 +0000 | [diff] [blame] | 7 | #include "pyconfig.h" |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 8 | |
Fred Drake | 4c82b23 | 2000-06-30 16:18:57 +0000 | [diff] [blame] | 9 | time_t |
Thomas Wouters | f70ef4f | 2000-07-22 18:47:25 +0000 | [diff] [blame] | 10 | PyOS_GetLastModificationTime(char *path, FILE *fp) |
Guido van Rossum | be0e942 | 1993-12-24 10:32:00 +0000 | [diff] [blame] | 11 | { |
| 12 | struct stat st; |
Guido van Rossum | aee0bad | 1997-09-05 07:33:22 +0000 | [diff] [blame] | 13 | if (fstat(fileno(fp), &st) != 0) |
Guido van Rossum | be0e942 | 1993-12-24 10:32:00 +0000 | [diff] [blame] | 14 | return -1; |
| 15 | else |
| 16 | return st.st_mtime; |
| 17 | } |