Mail Archives: djgpp/1994/08/25/16:57:46
> Forgive me a perhaps stupid question, but how can we expect stat() under
> DOS to know about TZ? For this to work, the OS itself should know about
> TZ and it should store files' timestamps in GMT, am I right here? If I am,
> then this can't be made right with DOS, which always works in *local time*.
stat() is a library function, not an OS call. The OS only knows about
local time, as you correctly noted--in particular, the year, month, day,
hours, minutes and seconds (to the nearest even number); the year is an
offset from 1980.
stat(), on the other hand, returns Unix-style times--that is, absolute
seconds since 1 Jan 1970 *GMT*. Therefore stat() must know about time-
zones in order to convert between the local time of the actual DOS time-
stamp and the GMT stat() values (st_mtime, st_ctime, etc.). The obvious
way to do this is to call tzset(), etc., internally. Note that all DOS
and OS/2 compilers I've investigated, either personally or secondhand,
do handle this correctly, with the exception of djgpp--MSC, Borland, IBM,
emx+gcc, Watcom, etc.
> And while on this point, does anyone know where can I found the definition
> of how stat() should use TZ? Some POSIX paper, maybe? Any site which
> offers such a definition by anon ftp?
I would also be interested in such information.
Greg
- Raw text -