Hieb, Michael
1998-Dec-04 19:10 UTC
timezones not properly reflected on timestamps of files
I have read the documentation, performed the diagnostic tests, checked the archives, so if the answer is there, please accept my apologies in advance and simply direct me. I am running redhat Linux 2.0.3 and using smbmount to mount several directories from NT3.51 servers which are distributed gloablly in different timezones. Once mounted the files all have local timestamps which makes syncing impossible. Further, if a file is written from the Linux box, the file will have the Linux local timestamp on it, on the NT server, even if that time is in the future from the point of view of the local server. 1. I have run zic -l GB to set up timezones properly on the Linux box and see the TZ is properly set. [root@lnxuk1 /root]# zic -l GB [root@lnxuk1 /root]# exit [hieb@lnxuk1 hieb]$ echo $TZ GMT [hieb@lnxuk1 hieb]$ sh -c 'TZ=UTC0 date' Fri Dec 4 19:04:04 UTC 1998 [hieb@lnxuk1 hieb]$ (note Linux is running in the UK, five hours ahead of the server) 2. The time and timezone is properly set on the NT boxes, and seems to be recognized as such by samba. [hieb@lnxuk1 hieb]$ smbclient -L ntsrv2 Added interface ip=137.100.48.64 bcast=137.100.63.255 nmask=255.255.240.0 Server time is Fri Dec 4 14:04:09 1998 Timezone is UTC-5.0 Password: (note the server is on the East Coast of the US, thus UTC-5.0) So why are the timezones not reflected in the timestamps? Any help greatly appreciated. Michael
Eric Knudstrup
1998-Dec-05 17:26 UTC
timezones not properly reflected on timestamps of files
Here's the issue: The timestamps used for smbfs (and most, if not all, of the DOS derived file system formats) are stored in local time. If you are using these file systems acrossed time zones then I wouldn't expect to have much luck with having the timestamps set correctly unless you set all of your systems to the same time zone. Or, you could set the Linux kernel timezone tz_minuteswest to 300 and tz_dsttime using settimeofday(2). This will only be used in smbfs and the FATxx filesystems and won't be reflected in user space so users of the system won't be any wiser. Warning: This is a real hack. The only real way to fix this is to use a file system that does timestamps in GMT. I don't know if any updates have been made to CIFS to exchange file times in GMT? Cheers! Eric> Date: Fri, 4 Dec 1998 14:10:00 -0500 > From: "Hieb, Michael" <Hieb@WESTPORT.MSMAIL.AIGFPC.COM> > To: "'samba@samba.anu.edu.au'" <samba@samba.anu.edu.au> > Subject: timezones not properly reflected on timestamps of files > Message-ID: <FC76B201C0C2D111AFEC00A02462169A0109D15C@smtp.aigfpc.com> > > I have read the documentation, performed the diagnostic tests, checked > the archives, so if the answer is there, please accept my apologies in > advance and simply direct me. > > I am running redhat Linux 2.0.3 and using smbmount to mount several > directories from NT3.51 servers which are distributed gloablly in > different timezones. Once mounted the files all have local timestamps > which makes syncing impossible. Further, if a file is written from the > Linux box, the file will have the Linux local timestamp on > it, on the NT > server, even if that time is in the future from the point of > view of the > local server. > > 1. I have run zic -l GB to set up timezones properly on the Linux box > and see the TZ is properly set. > [root@lnxuk1 /root]# zic -l GB > [root@lnxuk1 /root]# exit > [hieb@lnxuk1 hieb]$ echo $TZ > GMT > [hieb@lnxuk1 hieb]$ sh -c 'TZ=UTC0 date' > Fri Dec 4 19:04:04 UTC 1998 > [hieb@lnxuk1 hieb]$ > > (note Linux is running in the UK, five hours ahead of the server) > > 2. The time and timezone is properly set on the NT boxes, and seems to > be recognized as such by samba. > [hieb@lnxuk1 hieb]$ smbclient -L ntsrv2 > Added interface ip=137.100.48.64 bcast=137.100.63.255 > nmask=255.255.240.0 > Server time is Fri Dec 4 14:04:09 1998 > Timezone is UTC-5.0 > Password: > > (note the server is on the East Coast of the US, thus UTC-5.0) > > So why are the timezones not reflected in the timestamps? Any help > greatly appreciated. > > Michael