platform/macclassic.c
changeset 247 fd2af57f1e93
parent 240 052041af9001
child 316 29a4d12d1dc6
equal deleted inserted replaced
246:daf8765d4354 247:fd2af57f1e93
   806 } /* __PHYSFS_platformReleaseMutex */
   806 } /* __PHYSFS_platformReleaseMutex */
   807 
   807 
   808 
   808 
   809 PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
   809 PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
   810 {
   810 {
   811     BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);  /* !!! FIXME! */
   811     FSSpec spec;
       
   812     CInfoPBRec infoPB;
       
   813     UInt32 modDate;
       
   814 
       
   815     BAIL_IF_MACRO(fnameToFSSpec(fname, &spec) != noErr, ERR_OS_ERROR, -1);
       
   816 
       
   817     memset(&infoPB, '\0', sizeof (CInfoPBRec));
       
   818     infoPB.dirInfo.ioNamePtr = spec.name;
       
   819     infoPB.dirInfo.ioVRefNum = spec.vRefNum;
       
   820     infoPB.dirInfo.ioDrDirID = spec.parID;
       
   821     infoPB.dirInfo.ioFDirIndex = 0;
       
   822     BAIL_IF_MACRO(PBGetCatInfoSync(&infoPB) != noErr, ERR_OS_ERROR, -1);
       
   823 
       
   824     modDate = ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) ?
       
   825                    infoPB.dirInfo.ioDrMdDat : infoPB.hFileInfo.ioFlMdDat;
       
   826 
       
   827     /* epoch is different on MacOS. They use Jan 1, 1904, apparently. */
       
   828     /*  subtract seconds between those epochs, counting leap years.   */
       
   829     modDate -= 2082844800;
       
   830 
       
   831     return((PHYSFS_sint64) modDate);
   812 } /* __PHYSFS_platformGetLastModTime */
   832 } /* __PHYSFS_platformGetLastModTime */
   813 
   833 
   814 /* end of macclassic.c ... */
   834 /* end of macclassic.c ... */
   815 
   835