Purpose: discuss coding techniques to ensure cross platform compatibility between platforms.
On Unix and Windows NT, time keeping revolves around Jan 1, 1970. On the Mac, it is Jan 1, 1904. Thus, you have to be careful using file stat and file mtime looking at dates. Jon Guyer suggested in news:[email protected] that you should use
set time [clock format [file mtime $filename] ]
so that you don't worry about what the epoch is on the platform in use.
You can find out which epoch your platform uses, with
clock format 0 -gmt 1 ;# RS
Windows (all?) have 2-second granularity on disk, so a file dated 01:23:45 will end up being dated 01:23:44 instead. A compare on file mtime may fail, depending on context. Just get rid of the lower bit:
if {($time1 - [file mtime $filename]) & ~1} { puts "different" }