[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] new UTC/NTP documentation uploaded



On Mon, Dec 18, 2000 at 04:32:36PM +0200, Martin-Éric Racine wrote:
> On Mon, 11 Dec 2000, Martin-Éric Racine wrote:
> 
> > Includes corrections and suggestions received over the last few
> > days, through this list and via private mail.
> > 
> > http://pp.fishpool.fi/~q-funk/mint-UTC.htm
> 
> Btw, for those interrested in this, I have consulted with the NTP
> development team to find out how Tsettimeofday() is handled on
> other Unices and it seems that it is presumed to work in UTC,
> while the second argument (timezone) is only an optional info; if
> omitted, the time passed by the function is assumed to be UTC.

For Linux this is slightly different (I would guess the same holds true
for BSD derivates): The member 'tz_dsttime' is always ignored and should
be zero if the second (timezone) argument to settimeofday(2) is not NULL.
The 'tz_minuteswest' member is a little tricky under Linux.  If non-zero
then it is presumed to hold the offset of the hardware clock to UTC and
the Linux kernel will perform a "time warp" then.

For Linux this is fine because the kernel does not have to know at all
about local time.  The settimeofday call with a timezone argument is only
a hack to make the kernel do that time warp, normally at system start-up
time (the time warp is only done if the first call to
settimeofday(2) after booting the system has a non-NULL timezone
argument).

Under MiNT things are different: Because of the legacy functions that
operate on GEMDOS timestamps - which always represent local time - the
kernel always /has/ to know the difference between UTC and local time and
cannot just forget about it once it has done that time warp.  The time
warp is therefore initiated by an Ssystem(2) call and the 'tz_minuteswest'
member of struct timezone is always significant, both in Tsettimeofday(2)
and Tgettimeofday(2).

Ciao

Guido

P.S.: In the GNU libc for Linux, settimeofday() is only a wrapper around
stime() and a non-NULL timezone argument will generate an ENOSYS.