Hi,
I have an application that I want to have a feature where it synchronizes the Windows system clock, but only setting the minutes, unless for example the system time is 13:58 and the time server is 14:02, in which case the hour should be changed too. The thing is, I don't want to use the time server hours/days etc because I want the user to be able to set the clock to any time (regardless of time zone) but for it to still synchronize.
For example even if the windows timezone is PST and the user sets the clock 5 hours in the future without changing the time zone, I want the system to synchronize correctly, keeping it 5 hours in the future.
Is there an algorithm that could calculate whether it should be setting the hour forward or backwards an hour depending on the minutes but disregarding any time zone factors? If the system is 15:59 and the server is 16:02 the system should set to 16:02 rather than 15:02 (which it would if it only changed the minutes). If the system is 15:28 and the server is 16:02, the system should be set to 15:02. I've been mulling this over for a while now, but can't seem to get my head around how I would go about it!
I already have the code to get the time server date and time, and the system time (I'm using delphi), so it's just a matter of calculating what to do with it.
Thanks for your time.