Red Hat Bugzilla – Bug 4064
Incorrect timestamp on VFAT file systems.
Last modified: 2008-08-01 12:22:51 EDT
File timestamps written under Linux to a VFAT file
system are incorrect under MS-DOS when the Linux
Local Time is determined by a "dual" timezone variable,
e.g., TZ=EST5EDT, representing Standard/Daylight time.
Red Hat Linux v6.0 (Intel), kernel version 2.2.5-15;
MS-DOS versions 6.22 and 7 (Windows 98).
Timestamps for files on an ext2 file system are
maintained as UTC whereas for files on a VFAT file system
they are by design maintained as Local Time.
When the computer's Local Time is determined by a
"single" timezone variable, e.g., TZ=EST5, files are
written to a VFAT file system with the correct Local Time
insofar as both Linux and MS-DOS are concerned.
When however the computer's local time is determined by
a "dual" timezone variable, e.g., TZ=EST5EDT, the time
offset used is _always_ that of the Daylight part of the
variable, e.g., "EDT", regardless of the system date or
file date. Thus when a file originally created in Standard
time is examined under MS-DOS (or with the mtools utility
'mdir') the Local Time is off by one hour. (Note: The
Local Time as displayed under Linux is correct.)
The same problem is observed on all VFAT media: Hard drive,
Floppy disk, Iomega ZIP disk.
Consider two files created on an ext2 file system, both
at 07:00 UTC, but one in January and the other in July.
A directory listing under Linux with Local Time determined
by TZ=EST5EDT displays the file times as:
exhibiting the correct 5 and 4 hour offsets from UTC for
Standard and Daylight times.
If both files are now copied to a VFAT file system, say
on a floppy disk, while preserving the file dates ('cp -p'),
Linux still displays the same Local Times as above. But
if the floppy directory is displayed under MS-DOS (or with
the mtools utility 'mdir'), the file times are both 03:00.
(Note: An examination of the file time bit-fields in the
floppy directory also shows them to be both 03:00).
The same problem exists regardless of: system date; whether
the hardware clock is maintained in UTC or Local Time;
whether the /etc/localtime link is set to .../US/Eastern
or .../UTC (the last with TZ=EST5EDT).