I am looking for how i can build a service that is aware when the system clock is adjusted in windows e.g. by getting some notification when w32time performs a synchronisation to time.windows.com
To give some context, I have an service that I recently converted to a service that collects information throughout the day, and in case of a crash, it uses the system clock to recover the state accumulated throughout the day.
Recently I diagnosed a problem with the service and state recovery and what i whitnessed was that the moment my service is launched it reports a wrong date- my working theory is that my service is effectively started before the system clock has been adjusted.
So what I would like to do is reinitialize the state when I detect that the system clock has been synchronized where effectivly the day has been changed. I am aware that there is SystemEvents.TimeChanged
but from what I can gather from MSDN this event only reports user-initiated events and may not work for regular system clock synchroniation.
This brings me to the point where I'm looking for an alternatives ways of detecting when the system clock has been adjusted.