Ian Branch 128 Posted February 7, 2019 Hi Guys, One of my Users has to have some of their PCs set to their local time and others to a different timezone. :-( This is causing grief in the logs as 'Now' gives the current PCs time. Is there a way to retrieve the Server's current Date/Time, also their local time, so the Logs will be correct? The Server is a Windows 2012 R2 server. Is there a better mechanism? Regards & TIA, Ian Share this post Link to post
Sherlock 663 Posted February 7, 2019 There is an established protocol for this called NTP. However, it is based on UTC and clients must add their timezone information. So to achieve your goal, you could either implement an NTP client, with the possibility to configure his own private timezone, or just deduct the timezone differences. Or you could give those fellows who set their PCs to different timezones a good whack on the back of their heads. If they need to see a different time, either they or the special software they use, should do aforementioned basic math, I am pretty sure some client/server packages wont appreciate this behavior. A neat trick that involves only minor changes is to log UTC time. Just remember to add your timezone when evaluating the logs. Share this post Link to post
Ian Branch 128 Posted February 7, 2019 (edited) HI Sherlock, Tks for the input. I had considered UTC but the Users are not the brightest. 😞 As for the need to have a timezone different to local, it is due to a multinational's online software requiring them to be in the same TZ as their server. 😞 Unfortunately the Users can't do anything about it. 😞 I could use an NTP service I suppose providing it was going to return the Local DTG including DST. Have to look at some techniques. Regards, Ian Edited February 7, 2019 by Ian Branch Share this post Link to post
Sherlock 663 Posted February 7, 2019 19 minutes ago, Sherlock said: I am pretty sure some client/server packages wont appreciate this behavior. + 10 minutes ago, Ian Branch said: it is due to a multinational's online software requiring them to be in the same TZ as their server. Nice! Just as I predicted only with a twist 👿. Pretty shitty software, considering it is supposed to be multinational, if I may say so. But back to the problems we can solve: 10 minutes ago, Ian Branch said: I had considered UTC but the Users are not the brightest. So the users have to evaluate log files? How about you create a log reader, that will make the timezone calculations for them? Or you could store the correct timezone information in your own settings and use them when writing logs - remember however to calculate correct daylight savings time in both cases. Share this post Link to post
Ian Branch 128 Posted February 7, 2019 Hi Sherlock, Having a play with Indy and NTP att. Works fine here, Will have to test on the clients network to make sure the port is open. Some progress I guess. Thanks for the input. Ian Share this post Link to post
Sherlock 663 Posted February 7, 2019 3 hours ago, Ian Branch said: I could use an NTP service I suppose providing it was going to return the Local DTG including DST. My understanding is: It wont. You have to add your timezone information to the resulting UTC. So don't bother with your own ntp-client implementation. Just store the timezone offset between local time and client time. Share this post Link to post
Ian Branch 128 Posted February 8, 2019 (edited) Hi Sherlock, After all the investigation the issue has become moot. The Customer has decided to tell the multinational to fix their end and he has set all their wkstns to his local time. Problem resolved however it was an interesting exercise. My thank to all concerned for your input. Ian P.S. As a Bonus - The little NTP test app I did found a PC on the Customer's network that had the Time/TZ incorrectly set up. They are no longer in daylight saving but the flag was still set and the user had manually adjusted the clock to local/non dst time. 😞 It should have been all auto. Fixed. Edited February 8, 2019 by Ian Branch Share this post Link to post