The kernel variable sys_tz which is used by the msdos filesystem is not being set by the date command or the timeconfig utility in /usr/sbin/setup. As a result, the files written to an msdos floppy in linux are stamped in UTC rather than local clock time which msdos and windows assume. Note: a call to settimeofday() can be used to correct this, but this should be done by the O.S. itself, not by an application. here is code to test and correct the problem and a test run: code (timetest.cpp): ========================================== ////////////////////////////////////////////////////// // timetest.cpp // code to demonstrate and fix failure to update kernel timezone variable // in redhat linux which causes incorrect timestamps to be written on msdos // filesystems // Ed Rapoport 22.9.1999 // erapopor // #include <sys/time.h> #include <unistd.h> #include <ostream.h> #include <errno.h> #include <stdio.h> main(int argc, char* argv[]) { struct timezone fred; time_t now = time(NULL); int stat=0; stat = gettimeofday(NULL, &fred); if(stat) { perror("perror: "); } else { cout << fred.tz_minuteswest << " current minutes west of UTC.\n"; } fred.tz_minuteswest = (int) difftime( mktime(gmtime( &now )), mktime(localtime( &now ))) / 60; fred.tz_dsttime=0; cout << "Minutes west of UTC to set for local time: " << fred.tz_minuteswest << endl; stat = settimeofday(NULL, &fred); if(stat) { perror("perror: "); } stat = gettimeofday(NULL, &fred); if(stat) { perror("perror: "); } else { cout << fred.tz_minuteswest << " now minutes west of UTC.\n"; } } testrun: ========================================== g++ timetest.cpp -o timetest % su # ./timetest 0 current minutes west of UTC. Minutes west of UTC to set for local time: 300 300 now minutes west of UTC.
It works in 6.2: [root@hoser /root]# ~teg/timetest 300 current minutes west of UTC. Minutes west of UTC to set for local time: 300 300 now minutes west of UTC. [root@hoser /root]#