blob: f0ac89972000b2370c80a7af9a1d518cc31cc7bf [file] [log] [blame]
Guido van Rossumbe0e9421993-12-24 10:32:00 +00001
2/* Subroutine to get the last modification time of a file */
3
4/* (A separate file because this may be OS dependent) */
5
Fred Drake4c82b232000-06-30 16:18:57 +00006#include "Python.h"
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +00007#include "pyconfig.h"
Guido van Rossumb6775db1994-08-01 11:34:53 +00008
Fred Drake4c82b232000-06-30 16:18:57 +00009time_t
Thomas Woutersf70ef4f2000-07-22 18:47:25 +000010PyOS_GetLastModificationTime(char *path, FILE *fp)
Guido van Rossumbe0e9421993-12-24 10:32:00 +000011{
12 struct stat st;
Guido van Rossumaee0bad1997-09-05 07:33:22 +000013 if (fstat(fileno(fp), &st) != 0)
Guido van Rossumbe0e9421993-12-24 10:32:00 +000014 return -1;
15 else
16 return st.st_mtime;
17}