16

In my country, the official time changes in the first month of spring and fall. When the official time changes, my mobile phone's and PC's clocks change as well.

How do these devices find out there's a change?

2
  • wow. daylight savings for half the year
    – mcalex
    Commented Dec 24, 2012 at 12:08
  • 2
    The computer knows what time it is right? And you know what date daylight savings is supposed to change right? Therefore it is trivial to write a line of code into the OS that says if (date=DST_START) then hour=hour+1 else if (date=DST_END) then hour=hour-1 Usually this is enough, but if the rules change (like in North America in 2007), you need to download an OS update. Other than that, the only catch is that if the system clock is wrong (e.g., dead motherboard battery), then it cannot know when to change the time (but that’s irrelevant since you need to fix the date and time anyway).
    – Synetech
    Commented Dec 27, 2012 at 6:07

4 Answers 4

21

Most operating systems have the basic rules to calculate this (e.g. first weekend after a specific date), so they can adjust on their own, without requiring a connection to any time server. This can however screw up the system's clock in case there are changes of the official rules (e.g. the latest changes for Russia) or a system backup is restored (so the system adjusts the time twice).

As an alternative, some devices might contact a remote server (they most likely do it all the time anyway) or use some other kind of embedded timestamp (e.g. broadcast as part of video text/ceefax or DVB data, when talking about television programs and receivers/recorders/TVs).

Edit: Just to mention it: Older versions of Windows (e.g. Windows 95 or Windows 98) never trusted their own estimate, so they always told the user to verify the correct time once it changed. Windows Vista and Windows 7 (not sure about the versions in between) no longer do this and just assume they're right (in addition to using a time server to sync the clock).

2
  • NTP does not contain any DST or timezone information. It just establishes what the current time is in UTC. The client must separately apply rules appropriate to their timezone, using the Olson database or equivalent. Windows Time Service appears to implement only NTP, with no means of disseminating updated timezone rules: technet.microsoft.com/en-us/library/cc773061(v=ws.10).aspx
    – dhasenan
    Commented Dec 24, 2012 at 16:41
  • Okay, so NTP can only be used to determine whether the local clock is still/already on DST in case the system thinks there should be an adjustment (e.g. after reverting to a backup). But yeah, sounds logical, considering UTC/GMT+0 never changes. Reworded that sentence a bit.
    – Mario
    Commented Dec 24, 2012 at 16:44
8

Linux uses IANA time zone database to know when DST changes. A different story is for Windows for a number of reasons. One, Windows uses RTC in local time and Linux - in UTC. Imagine that a DST changes on Windows. This allows files to be "created" in the future and it may cause some problems. Also, older Windows treat DST differently, because then there were different DST rules and Microsoft does not provide updates for those Windows versions anymore, so they cannot now of changes in DST rules.

More on that here: http://en.wikipedia.org/wiki/Daylight_saving_time#Computing

2

Quite simply put, your OS pushes through an update to adjust the time.

Windows does this through Windows Update, and Linux through the use of timezone files.

1
  • Not exactly true for Windows, at least not for older versions. Windows is able to calculate this on its own (similar to Linux), but this something needs updates due to no rules (as you linked).
    – Mario
    Commented Dec 24, 2012 at 12:16
1

Mobile phones manage to update the time through the network. Similarly in case of Windows, it updates through the internet. This works only if you have opted for auto time update. You can check the Date and Time settings on your mobile or PC. enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .