Jump to content
omnibrain

TIdSNTP still providing daylight saving time

Recommended Posts

I am using Delphi 11.2 (Patch 1) on Windows 11 (22H2):

A few weeks ago, I added a check to our software to be able to verify against a time server independently of the rest of the system, as our customers had issues with internal network time synchronization in the past. Since Sunday, we "suddenly" have a one-hour deviation. Last weekend we went back from UTC+2 to UTC+1.

 

I have simplified it to the most basic test possible, just a form with a TIdSNTP component and an edit box to enter the server. And even then, I still get a time that is exactly one hour in the future. Have I overlooked something? Since we are now on "standard time," I would have expected there to have been problems during development and testing in the past weeks.

  IdSNTP1.Host:=LabeledEdit1.Text;
  memo1.Lines.Add('Server: '+LabeledEdit1.Text+' Internet time: '+DateTimeToStr(IdSNTP1.DateTime)+' Local time: '+datetimetostr(now));

The result is:

Quote

Server: ptbtime1.ptb.de Internet time: 30.10.2023 11:54:00 Local time: 30.10.2023 10:54:00
Server: time.nist.gov Internet time: 30.10.2023 11:54:08 Local time: 30.10.2023 10:54:20

 

Edited by omnibrain

Share this post


Link to post

SNTP just receives UTC time. Conversion to local time must be done with system functions using system's database of daylight zones. Probably you have obsolete DB

Share this post


Link to post
9 minutes ago, Fr0sT.Brutal said:

SNTP just receives UTC time. Conversion to local time must be done with system functions using system's database of daylight zones. Probably you have obsolete DB

Of course, but in the code of the component there is "NTPToDateTime" and in there "UTCTimeToLocalTime".
And like I said. Last week it worked. I would have expected an error of 2 hours last week, if this was the case.

Share this post


Link to post

Ah, I see. Thank you.

I did not know, that Indy is on github.

Let's hope the fixed version comes with Delphi 12.

Share this post


Link to post
3 hours ago, omnibrain said:

I did not know, that Indy is on github.

Yes, and has been for several years now:

https://www.indyproject.org/2019/11/28/indy-svn-retiring-long-live-github/

3 hours ago, omnibrain said:

Let's hope the fixed version comes with Delphi 12.

Yes, it will include an updated snapshot of Indy from about a month ago.  However, you don't have to upgrade Delphi just to get a new Indy version.  You can install the latest GitHub repo version manually:

https://github.com/IndySockets/Indy/wiki/Updating-Indy

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×