linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <bh40@calva.net>
To: Gabriel Paubert <paubert@iram.es>, <linuxppc-dev@lists.linuxppc.org>
Subject: Re: rtc again...
Date: Wed, 9 Aug 2000 17:25:41 +0200	[thread overview]
Message-ID: <20000809152541.9611@mailhost.mipsys.com> (raw)
In-Reply-To: <Pine.HPX.4.10.10008091436330.22126-100000@gra-ux1.iram.es>


>
>I agree on the point if setting the timezone at boot, that's basically the
>only thing I would consider permissible. For the rest the RTC is running
>as is, and /dev/rtc gives you direct acces to the HW: no cooked values,
>you always end up losing when playing such games.

Ok. Then for this to work, we need to slightly change the boot code not
to call simply ppc_md.get_rtc_time(), but to also adjust it on pmac using
the pram timezone. That means adding a new ppc_md.fixup_time() used only
at boot, or adding a "fixup" parameter to ppc_mc.get_rtc_time() set to 0
in normal cases and to 1 on first call during boot.

>I do see some: principle of least surprise for people porting applications
>between PC and Mac. Minimize #ifdef noise in their sources...

Well, it's nice to save back the timezone to the xpram (the code Paul
added). But it's probably not good to do so from ppc_md.set_rtc_time().
So that would yet another #if/_MACH_Pmac hack...

>During Linux boot: read the time and offset from xpram and set xtime
>accordingly (preventing further timewarps by using do_sys_settimofday),
>then clear the timezone info in the RAM, and rewrite the clock so that it
>runs in UTC.

Clear the tz info in nvram ? why ? That would probably harm MacOS... And
I don't like writing to nvram when it's not necessary (nvram is a flash
on some machines). I would rather let the RTC run in local time and pass
localtime to userland, letting the user set the userland tool correctly
and so behave like other archs with local time RTC. So to resume, what I
need to fix is:

 - change ppc_md.get/set_rtc_time() to set and return the raw time from
the RTC
 - at boot, apply only once the offset from nvram, initialize sys_tz and
call do_sys_settimeofday()
 - Figure out a way to write back the timezone to nvram (since I think
sys_tz is updated by userland tools via settimeofday, isn't it ?) when
changed.

>Yes, this is strange, but the original error lies with Apple storing the
>time as local time while keeping also the timezone. I can understand and
>even agree on keeping the timezone and the DST flag in RAM, but then why
>the heck do you want to store the RTC in local time ? It only makes thing
>more complex around DST changes or when changing timezones when you
>travel. I thought Macs were about simplicity...

Macs are about simplicity, MacOS internals are not ;)

>Who uses FAT anyway ? I'm going to patch my kernels to kill sys_tz, now
>that I've come to the conclusion that its mere existence is an
>aberration... With an UTC clock, it's the only sensible solution ;-). But
>I don't suggest that everybody should do the same...

Hum...


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  reply	other threads:[~2000-08-09 15:25 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-08 14:31 rtc again Iain Sandoe
2000-08-08 17:08 ` Michael Schmitz
2000-08-08 17:41   ` Benjamin Herrenschmidt
2000-08-08 22:44     ` Gabriel Paubert
2000-08-09  8:44       ` Benjamin Herrenschmidt
2000-08-09 11:32         ` Martin Costabel
2000-08-09 13:50         ` Gabriel Paubert
2000-08-09 15:25           ` Benjamin Herrenschmidt [this message]
2000-08-09 16:54             ` Takashi Oe
2000-08-09 17:04               ` Benjamin Herrenschmidt
2000-08-09 23:12                 ` Takashi Oe
2000-08-09 23:48                   ` Benjamin Herrenschmidt
2000-08-09 22:13             ` Gabriel Paubert
2000-08-09 22:48               ` Benjamin Herrenschmidt
2000-08-10  3:08                 ` Gabriel Paubert
2000-08-10  0:00               ` William Blew
2000-08-09 14:26         ` Takashi Oe
2000-08-09  0:55     ` Takashi Oe
2000-08-09  8:48       ` Benjamin Herrenschmidt
2000-08-09 16:37         ` Takashi Oe
2000-08-09 22:46           ` Gabriel Paubert
2000-08-09 14:24     ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2000-08-08 11:35 Iain Sandoe
2000-08-08 13:14 ` Geert Uytterhoeven
     [not found] <20000804205524.383@192.168.1.10>
2000-08-05  1:10 ` Takashi Oe
2000-08-05 11:25   ` Benjamin Herrenschmidt
2000-08-05 14:44     ` Takashi Oe
2000-08-03 11:24 Iain Sandoe
2000-08-03  9:56 Iain Sandoe
2000-08-03 10:13 ` Benjamin Herrenschmidt
2000-08-03 11:58 ` Martin Costabel
2000-08-03  9:41 Iain Sandoe
2000-08-02 22:48 Iain Sandoe
2000-08-03  9:00 ` Martin Costabel
2000-08-03  9:30   ` Benjamin Herrenschmidt
2000-08-03 10:54     ` Gabriel Paubert
2000-08-03 11:14       ` Benjamin Herrenschmidt
2000-08-03 11:25         ` Gabriel Paubert
2000-08-03 11:45         ` Gabriel Paubert
2000-08-03 13:25           ` Benjamin Herrenschmidt
2000-08-03 23:33       ` Takashi Oe
2000-08-04  8:55         ` Gabriel Paubert
2000-08-04 15:25           ` David Edelsohn
2000-08-04 15:50             ` Benjamin Herrenschmidt
2000-08-07 12:33               ` Gabriel Paubert
2000-08-07 11:51             ` Gabriel Paubert
2000-08-07 13:18               ` Benjamin Herrenschmidt
2000-08-07 15:14               ` David Edelsohn
2000-08-07 21:16                 ` Gabriel Paubert
2000-08-08  1:39               ` Paul Mackerras
2000-08-11 11:04                 ` Gabriel Paubert
2000-08-12  6:29                   ` Paul Mackerras
2000-08-12 12:02                     ` Ethan Benson
2000-08-12 12:51                       ` Gabriel Paubert
2000-08-12 18:46                     ` Gabriel Paubert
2000-08-14 12:59                     ` Gabriel Paubert
     [not found]       ` <Pine.LNX.3.96LJ1.1b7.1000803182949.650C-100000@ofey.earthl ink.net>
2000-08-03 23:58         ` Franz Sirl
2000-08-04  0:33           ` Takashi Oe
2000-08-04 12:54             ` Benjamin Herrenschmidt
2000-08-04 13:40               ` Takashi Oe
2000-08-04 13:20       ` Geert Uytterhoeven
2000-08-08 11:20         ` Gabriel Paubert
2000-08-03 10:31   ` Franz Sirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000809152541.9611@mailhost.mipsys.com \
    --to=bh40@calva.net \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=paubert@iram.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).