2

I would like to know more about how DST works in Debian (and probably Debian-based distros).

Imagine the following: A computer running the newest version of debian is using the timezone Europe/Zurich. Daylight savings time will start on 2018-03-25 02:00, meaning it will change from UTC+1 to UTC+2. What would happen on that day if the computer has no network connection (no NTP servers basically)? Would it still alter the UTC offset to +2 or is it absolutely dependent on NTP? Why?

dislick
  • 135
  • 1
  • 5

3 Answers3

5

The kernel's idea of time doesn't track daylight savings; usually we let the kernel record time in UTC. This has the advantage that it's unambiguous and simple.

User-facing programs have a timezone, normally passed in the TZ environment variable so that they have consistent view. This is used for converting the internal representation to or from a form that users are happy with.

You can see this in effect if you do

TZ=Europe/Zurich ls -logd
TZ=Australia/Perth ls -logd

The same timestamp is presented two different ways.

The daylight savings adjustment is kept in the timezone database that's installed on your system. As long as that is correct, times in the summer will convert differently from UTC than do times in the winter (in regions with DST). And the timezone database knows all about the rules in the past and has a good idea about the future, except when politicians start meddling.

You only need an external connection if the rules change and you have to install an updated timezone database.

Toby Speight
  • 8,460
  • 3
  • 26
  • 50
3

The system changes its time offset based on the configured time zone by referring to the data stored in the tzdata package. It doesn’t need an external time source.

An external time source provides a reference time independently of the configured time zone, and whether or not daylight savings time is enabled (otherwise you would only be able to use NTP servers configured to use the same time zone as the system you want to update).

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
2

Timezones and DST are handled by the OS. The NTP service only provides time synchronization and is agnostic about the timezone the machine is in.

Therefore your machine will switch correctly on or out of DST at the right moment (assuming the time is correct), even if it has no network connection.

dr_
  • 28,763
  • 21
  • 89
  • 133