How can I check the user's system time (easy) against the "real" time (their time may be set wrong) and then inform them and offer to update their system time to the actual time and then do so?
IOW, pseudocode:
DateTime dtSet = DateTime.Now;
DateTime dtActual = GetActualTime();
if (dtSet != dtActual) // allow some delta, such as anything under a 1 minute variance)
{
if (UserAllowsChange())
{
ChangeTheTimeTo(dtActual);
}
}
Maybe Noda Time is in my future. I can't help it, but every time I see that name, I think of the song by Don Williams/Eric Clapton.
A process must have the SE_SYSTEMTIME_NAME
privilege to set the system time. A Windows Store app will never have this privilege. Windows Store apps run in a sandbox, called an app container, and are limited in how they can interact with the rest of the system.
From an ordinary desktop app that has sufficient privileges, SetSystemTime
may be used to set the system time.