Dalija Prasnikar 1396 Posted July 17, 2019 I need to check whether or not current computer time is correct (with some tolerance) and currently have following code. LTime := TIdTime.Create(nil); try LTime.Host := 'time.nist.gov'; LTS := LTime.DateTime; // do something finally LTime.Free; end; It was working fine (AFAIK) until I upgraded the router and basic firewall setting now blocks port 37 which is used by TIdTime... but allows port 123 (UDP) so I switched from TIdTime to TIdSNTP and it is working again. So question is... is TIdTime obsolete... are there any gotchas with using TIdSNTP? Is it safe to switch to TIdSNTP and don't look back? I need to support Windows 7/8/10 with most common settings (software and hardware). If someone decides to specifically block everything... there is nothing I can do anyway. Share this post Link to post
Attila Kovacs 629 Posted July 17, 2019 here you can read about the time protocol: https://tf.nist.gov/tf-cgi/servers.cgi and because I would not query an oversea server https://www.pool.ntp.org/zone/europe Share this post Link to post
Dalija Prasnikar 1396 Posted July 17, 2019 1 hour ago, Attila Kovacs said: here you can read about the time protocol: https://tf.nist.gov/tf-cgi/servers.cgi Yes, and it says TIME protocol (the one that uses port 37) is obsolete... but I want to triple check that TIdSNTP is the way to go. 1 hour ago, Attila Kovacs said: and because I would not query an oversea server https://www.pool.ntp.org/zone/europe Works if you only need to support Europe... if not... Share this post Link to post
Remy Lebeau 1398 Posted July 18, 2019 (edited) On 7/17/2019 at 6:51 AM, Dalija Prasnikar said: Yes, and it says TIME protocol (the one that uses port 37) is obsolete... More accurately, it just says that the NIST ITS's usage of the TIME protocol is obsolete and NTP is preferred, not that the TIME protocol itself is obsolete. This page explains it a bit better: https://www.nist.gov/pml/time-and-frequency-division/services/internet-time-service-its Quote Time Protocol (RFC-868) This simple protocol is now used by only about 1% of ITS customers. It returns a 32-bit unformatted binary number that represents the time in UTC seconds since January 1, 1900. The server listens for Time Protocol requests on port 37, and responds in either tcp/ip or udp/ip formats. Conversion to local time (if necessary) is the responsibility of the client program. The 32-bit binary format can represent times over a span of about 136 years with a resolution of 1 second. There is no provision for increasing the resolution or increasing the range of years. The strength of the time protocol is its simplicity. Since many computers keep time internally as the number of seconds since January 1, 1970 (or another date), converting the received time to the necessary format is often a simple matter of binary arithmetic. However, the format does not allow any additional information to be transmitted, such as advance notification of leap seconds or daylight saving time, or information about the health of the server. However, the time format (as specified in RFC-868) has poor error-handling capabilities in general, and many of the client programs that use this format are poorly written and may not handle network errors properly. Therefore users are strongly encouraged to switch to the Network Time Protocol (NTP), which is more robust and provides greater accuracy. We eventually intend to phase out support for the TIME format on all servers. Quote but I want to triple check that TIdSNTP is the way to go. Yes. Edited July 18, 2019 by Remy Lebeau 1 Share this post Link to post