getmtime.c 318 Bytes
Newer Older
Guido van Rossum's avatar
Guido van Rossum committed
1 2 3 4 5

/* Subroutine to get the last modification time of a file */

/* (A separate file because this may be OS dependent) */

6
#include "Python.h"
7
#include "pyconfig.h"
8

9
time_t
10
PyOS_GetLastModificationTime(char *path, FILE *fp)
Guido van Rossum's avatar
Guido van Rossum committed
11 12
{
	struct stat st;
13
	if (fstat(fileno(fp), &st) != 0)
Guido van Rossum's avatar
Guido van Rossum committed
14 15 16 17
		return -1;
	else
		return st.st_mtime;
}