On or about 2005-03-02 14:40, Fritz Whittington whipped out a trusty #2 pencil
and scribbled:
On or about 2005-03-02 06:14, Alan McDonald whipped out a trusty #2
pencil and scribbled:
> I synchronise some files across an ftp connection. The files comes from a
> computer with the current date/time set, and my PC is also set with
> correct
> time (both clock and hwclock return the correct time). But the files
> which
> are writtin into the ftp directory are 13 hours ascew.. How can I correct
> this? Where is the magic setting for making files writen to disk obey the
> curret clock?
> thanks
> Alan
>
>
I'm presuming that this involves moving files from a Windows machine to
Linux, or vv. Both Windows and Linux use UTC for timestamps. The
difference is, in Windows you set the hardware clock to your local time,
tell it which timezone you're in, and it converts to UTC when stamping
file times. Likewise, it converts timestamps back to local time for
DISPLAY purposes when you list the directory.
Linux/Unix do it the other way. The hardware clock is usually set to
UTC, you tell it what time zone you're in, and the DISPLAY of times will
be in local, but timestamps on files will be in UTC.
As a convenience to those who have one machine with a dual-boot of
Windows/Linux, most distros allow you to declare that the hardware clock
is actually not UTC, but local. Then when Linux boots, it reads the
hardware clock, applies the TZ correction, then sets the system clock to
UTC. If you tell Linux the hardware clock is UTC, then it doesn't apply
the correction on boot, just sets the system clock to the hardware
clock, and goes on as usual.
Windows of course, has no facility to be told that the hardware clock is
on UTC, and to correct for local time zone on booting. So for Windows
you must set local time on the hardware clock.
Another problem is that you can have your Windows time zone set
incorrectly, and someone has set the hardware clock to compensate. So
if I in the US Central TZ set my Windows system to the Greenwich time
zone, then fiddle with the clock setting so that the time "looks
correct", then Windows will think it does not need to apply any
correction to get UTC, but all it's timestamps will then be off by 6
hours. (A file created at 8:00 am local time would actually be stamped
as 0800 UTC, when it really should be stamped as 0200 UTC.)
Oooops! That should be 1400 UTC, not 0200 UTC. Sorry if the example caused
even more confusion...
Similar things of course can happen in Linux, in the opposite
direction,
if you don't have your TZ data set correctly and just force the clock to
look like correct local time.
--
Fritz Whittington
Man is by nature a political animal. (Aristotle, Politics)