home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Python20_source / Python / getmtime.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-25  |  499 b   |  28 lines

  1.  
  2. /* Subroutine to get the last modification time of a file */
  3.  
  4. /* (A separate file because this may be OS dependent) */
  5.  
  6. #include "Python.h"
  7. #include "config.h"
  8.  
  9. #include <stdio.h>
  10. #ifndef DONT_HAVE_SYS_TYPES_H
  11. #include <sys/types.h>
  12. #endif
  13. #ifndef DONT_HAVE_SYS_STAT_H
  14. #include <sys/stat.h>
  15. #elif defined(HAVE_STAT_H)
  16. #include <stat.h>
  17. #endif
  18.  
  19. time_t
  20. PyOS_GetLastModificationTime(char *path, FILE *fp)
  21. {
  22.     struct stat st;
  23.     if (fstat(fileno(fp), &st) != 0)
  24.         return -1;
  25.     else
  26.         return st.st_mtime;
  27. }
  28.