• RTC, was Re: System time/timezone

    From David Wright@21:1/5 to Jeffrey Walton on Wed Jun 19 06:10:01 2024
    On Tue 18 Jun 2024 at 04:12:07 (-0400), Jeffrey Walton wrote:
    On Tue, Jun 18, 2024 at 4:05 AM <tomas@tuxteam.de> wrote:
    On Mon, Jun 17, 2024 at 11:54:03PM -0500, David Wright wrote:
    [...]
    I notice that man timedatectl says:

    set-timezone [TIMEZONE]
    Set the system time zone to the specified value.
    Available timezones can be listed with list-timezones.
    If the RTC is configured to be in the local time, this
    will also update the RTC time. This call will alter
    the /etc/localtime symlink. See localtime(5) for more
    information.

    I cringe a bit when I see that.

    Yeah.. on Linux, it is recommended to keep the RTC clock in UTC.
    Unless Windows has contaminated the machine. See <https://wiki.debian.org/DateTime>.

    Here's your subthread for discussing the RTC, as it's a separate
    issue from the system's time zone.

    (I believe I'm correct in saying that Windows has long been able,
    by means of a registry key setting, to run with the RTC set to UTC.)

    Cheers,
    David.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Nicholas Geovanis on Wed Jun 19 21:40:02 2024
    On Wed, Jun 19, 2024 at 14:16:14 -0500, Nicholas Geovanis wrote:
    <https://wiki.debian.org/DateTime>.

    Reading the link that Walton sent, the only case where RTC clock in UTC is recommended is in the linux/windows dual-boot case. There's no statement
    that RTC should be set to UTC besides that. And they say right there why it isn't mentioned: your Debian machine might move around geographically. But
    if it doesnt....

    Servers in data centers don't move around, they just sit there :-) So in my experience servers running anything non-windows have RTC set to local time. That's been on Red Hat/CentOS, Debian, Ubuntu.

    If your system only boots one operating system, and never changes its
    default time zone, then it makes no difference whether the RTC is set
    to UTC or local time. The OS will use the same assumptions when reading
    and writing to the RTC, so everything will remain correct.

    If you boot multiple operating systems, or if you ever change your
    default time zone, then keeping the RTC in UTC gives you a much better
    chance of things remaining correct.

    And of course, if your system is configured to retrieve the correct time
    from NTP servers immediately after booting, then the RTC's contents don't really matter much in the first place. You'd only "use" the RTC for the
    brief time between boot and NTP synchronization, or if for some reason
    you can't reach your NTP servers (Internet is down or whatever).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Monnier@21:1/5 to All on Thu Jun 20 04:00:01 2024
    If your system only boots one operating system, and never changes its
    default time zone, then it makes no difference whether the RTC is set
    to UTC or local time. The OS will use the same assumptions when reading
    and writing to the RTC, so everything will remain correct.

    Of course, the famous exception is if your machine is OFF during the
    switch to/from DST. IIUC there are hacks in Windows to try and handle
    it "correctly", but I believe they can also misfire in some cases.
    Don't know if GNU/Linux bothers with it: it's just a lot simpler and
    more sane to use UTC so you never need to worry about it.
    And of course, NTP is your friend: several of my machines don't even
    have an RTC and I haven't really felt like they are missing something.


    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to Nicholas Geovanis on Thu Jun 20 05:00:02 2024
    On Wed, Jun 19, 2024 at 02:16:14PM -0500, Nicholas Geovanis wrote:
    Reading the link that Walton sent, the only case where RTC clock in UTC is >recommended is in the linux/windows dual-boot case. There's no statement that >RTC should be set to UTC besides that. And they say right there why it isn't >mentioned: your Debian machine might move around geographically. But if it >doesnt....

    Servers in data centers don't move around, they just sit there :-) So in my >experience servers running anything non-windows have RTC set to local time.

    Which is great, except that for some reason we still have daylight
    saving time...which screws everything up. So the real answer is that
    keeping RTC in local time is great for servers which never move around
    and don't have DST *or never turn off*. In which case it doesn't really
    matter. Except for that corner case where it suddenly does, at which
    point you'll regret not having used UTC (which works reliably regardless
    of what the politicians have decided to do to local time, and regardless
    of how long a server has been turned off).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)