/RISCOS/Python/getmtime_riscos.c

http://unladen-swallow.googlecode.com/ · C · 20 lines · 16 code · 4 blank · 0 comment · 6 complexity · 097a775762f47f5c6601b911db2f944e MD5 · raw file

  1. #include <stdio.h>
  2. #define __swi
  3. #include "oslib/osfile.h"
  4. long PyOS_GetLastModificationTime(char *path, FILE *fp)
  5. {
  6. int obj;
  7. bits load, exec, ftype;
  8. if (xosfile_read_stamped_no_path(path, &obj, &load, &exec, 0, 0, &ftype)) return -1;
  9. if (obj != osfile_IS_FILE) return -1;
  10. if (ftype == osfile_TYPE_UNTYPED) return -1;
  11. load &= 0xFF;
  12. load -= 51;
  13. if (exec < 1855548004U) load--;
  14. exec -= 1855548004U;
  15. return exec/100+42949672*load+(95*load)/100;
  16. }