blob: 55ec5a3b635c906301eba80e5009d8d3c3101c0b [file] [log] [blame]
Guido van Rossumbe0e9421993-12-24 10:32:00 +00001/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00002Copyright (c) 2000, BeOpen.com.
3Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5All rights reserved.
Guido van Rossumbe0e9421993-12-24 10:32:00 +00006
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007See the file "Misc/COPYRIGHT" for information on usage and
8redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumbe0e9421993-12-24 10:32:00 +00009******************************************************************/
10
11/* Subroutine to get the last modification time of a file */
12
13/* (A separate file because this may be OS dependent) */
14
Fred Drake4c82b232000-06-30 16:18:57 +000015#include "Python.h"
Guido van Rossumb6775db1994-08-01 11:34:53 +000016#include "config.h"
Guido van Rossumb6775db1994-08-01 11:34:53 +000017
Guido van Rossumaee0bad1997-09-05 07:33:22 +000018#include <stdio.h>
Guido van Rossumbe0e9421993-12-24 10:32:00 +000019#include <sys/types.h>
20#include <sys/stat.h>
Guido van Rossumbe0e9421993-12-24 10:32:00 +000021
Fred Drake4c82b232000-06-30 16:18:57 +000022time_t
Guido van Rossumaee0bad1997-09-05 07:33:22 +000023PyOS_GetLastModificationTime(path, fp)
Guido van Rossumbe0e9421993-12-24 10:32:00 +000024 char *path;
Guido van Rossumaee0bad1997-09-05 07:33:22 +000025 FILE *fp;
Guido van Rossumbe0e9421993-12-24 10:32:00 +000026{
27 struct stat st;
Guido van Rossumaee0bad1997-09-05 07:33:22 +000028 if (fstat(fileno(fp), &st) != 0)
Guido van Rossumbe0e9421993-12-24 10:32:00 +000029 return -1;
30 else
31 return st.st_mtime;
32}