Skip to content

Update TIdTime to use UTC when setting the local system clock #194

@rlebeau

Description

@rlebeau

The TIdTime.SyncTime() method first calls TIdTime.GetDateTime(), converting the server's UTC time to local time, and then subsequently calls the IndySetLocaltime() function, re-converting the local time back to UTC time when setting the system clock.

This method is flawed for two reasons:

  1. Both routines retrieve the TimeZoneBias of the local computer, and the value will usually be identical in both cases. However, there are two moments each year when the TimeZoneBias is supposed to jump in countries that honor Daylight Saving Time. If local time is used to update the system clock at one of these moments, it's likely that the end result will be offset too much. For example, correcting the clock from March 25, 2018, 01:59:00 (CET) to 03:01:00 is just a two-minute correction, not a 62 minute correction.

  2. There really is no 1:1 relationship between local time and UTC time. In fact, there is an overlap interval at the end of DST that exists twice in local time because the clock is turned back. If the local time were tweaked to indicate October 28, 2018 02:30:00 (CET) then the computer would have no way of knowing if this was intended to be within the DST period or just afterwards!

So, TIdTime should be updated to use UTC time when getting the server time and setting the system clock, and not bother with local time at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: AcceptedIssue has been accepted to be worked onType: EnhancementIssue is proposing a new feature/enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions