Mercurial > cpython-lru_cache-weakref
annotate Python/getmtime.c @ 68231:5fd74354d73b 2.0
Close 2.0 branch.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 05 Mar 2011 14:54:19 +0100 |
| parents | 6f6f965c5e2d |
| children | 24dafbb0db58 |
| rev | line source |
|---|---|
| 1449 | 1 |
| 2 /* Subroutine to get the last modification time of a file */ | |
| 3 | |
| 4 /* (A separate file because this may be OS dependent) */ | |
| 5 | |
|
13226
12437deb0680
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
6243
diff
changeset
|
6 #include "Python.h" |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1449
diff
changeset
|
7 #include "config.h" |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1449
diff
changeset
|
8 |
|
6243
4279f4eb210a
First part of package support.
Guido van Rossum <guido@python.org>
parents:
5440
diff
changeset
|
9 #include <stdio.h> |
|
13267
4ce255495da3
Jack Jansen, Mac patch:
Guido van Rossum <guido@python.org>
parents:
13256
diff
changeset
|
10 #ifndef DONT_HAVE_SYS_TYPES_H |
| 1449 | 11 #include <sys/types.h> |
|
13267
4ce255495da3
Jack Jansen, Mac patch:
Guido van Rossum <guido@python.org>
parents:
13256
diff
changeset
|
12 #endif |
|
4ce255495da3
Jack Jansen, Mac patch:
Guido van Rossum <guido@python.org>
parents:
13256
diff
changeset
|
13 #ifndef DONT_HAVE_SYS_STAT_H |
| 1449 | 14 #include <sys/stat.h> |
|
13267
4ce255495da3
Jack Jansen, Mac patch:
Guido van Rossum <guido@python.org>
parents:
13256
diff
changeset
|
15 #elif defined(HAVE_STAT_H) |
|
4ce255495da3
Jack Jansen, Mac patch:
Guido van Rossum <guido@python.org>
parents:
13256
diff
changeset
|
16 #include <stat.h> |
|
4ce255495da3
Jack Jansen, Mac patch:
Guido van Rossum <guido@python.org>
parents:
13256
diff
changeset
|
17 #endif |
| 1449 | 18 |
|
13226
12437deb0680
Trent Mick <trentm@activestate.com>:
Fred Drake <fdrake@acm.org>
parents:
6243
diff
changeset
|
19 time_t |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13267
diff
changeset
|
20 PyOS_GetLastModificationTime(char *path, FILE *fp) |
| 1449 | 21 { |
| 22 struct stat st; | |
|
6243
4279f4eb210a
First part of package support.
Guido van Rossum <guido@python.org>
parents:
5440
diff
changeset
|
23 if (fstat(fileno(fp), &st) != 0) |
| 1449 | 24 return -1; |
| 25 else | |
| 26 return st.st_mtime; | |
| 27 } |
