Subject: Re: Time in NetBSD 7 hours behind
To: None <skanware@yahoo.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-help
Date: 10/23/2001 19:00:55
    Date:        Tue, 23 Oct 2001 04:29:08 -0700 (PDT)
    From:        Derek White <skanware@yahoo.com>
    Message-ID:  <20011023112908.85601.qmail@web20205.mail.yahoo.com>

  | Everything about
  | NetBSD has been great so far except I can't figure out
  | why NetBSD reports the time 7 hours slow.

That's a philosophical difference between unix and Wintrash.

Unix wants the system clock to be in UTC (GMT close enough).  Wintrash
wants it to be in local time.   Since you have the time correct in
Wintrash, you have the clock set 7 hours (US PDT) behind UTC.  Hence
when unix (any unix) gets the time, it will believe that the current
time is 7 hours before what it really is (to display the local time,
Wintrash just displays what is in the clock, unix subtracts the local
clock offset - 7 hours for you from the UTC time, and displays that).

To fix this, you could just throw away wintrash, set the time correctly
under NetBSD, and from then on, you'll be all set (you'll have UTC in
the system clock, which is the way all good clocks should run).

That's the optimal solution.

Unfortunately, it doesn't work for everyone.

If you have built a new kernel already (or if you're going to), include
in your kernel config file

options         RTC_OFFSET=420 # hardware clock is this many mins. west of GMT

(420 == 7*60 which is how many minutes west of GMT you are at the minute).

When you boot that kernel, all will be good (until Wintrash decides that
it needs to alter the clock because daylight saving has just turned on or
off - then you'll need a kernel with the offset set to 480 (which is what
US PST is away from UTC, in minutes - 8 hours).

If you're not going to build a new kernel, you can patch the one that
you have in /netbsd by (as root)

gdb --write /netbsd
set rtc_offset=420
quit

and then the next time you reboot all should be fine.   You need to reboot
for this to have effect, as the a hardware clock gets read, and this offset
applied, only when the kernel boots.

kre