Question

Just want to make sure one thing.
In a windows machine (either a desktop system or maybe a device like Windows Phone), if user changes the display time (maybe adjust time zone, or just change date/time in control panel), will that also changes the SYSTEMTIME or FILETIME. What will be changed if user changes the display time?

Thank you

Was it helpful?

Solution

First off, SYSTEMTIME and FILETIME are just data structures. They don't "change" in any meaningful way.

There are two functions that return SYSTEMTIME: GetSystemTime() and GetLocalTime(). The first one returns the UTC time (that of Greenwich, England, roughly), the second one returns time in the local timezone. If you just change the timezone, the output of GetLocalTime() will change, but that of GetSystemTime() won't. If you change the time but not the timezone, both will change.

In a highly contrived example where you change both timezone and current time exactly to compensate for the timezone difference, the value of GetLocalTime() will stay but GetSystemTime() will change.

And that's discounting the fact that output of either function tends to change with every millisecond. By "change" in the paragraphs above I mean "thrown off the regular passage of time".

There's one function that returns a FILETIME: GetSystemTimeAsFileTime(). Its output follows, quite naturally, that of GetSystemTime().

OTHER TIPS

As far as I know, unless you specifically check something else, "display time" is always what the system returns on a desktop. This may be different on mobile environments since time is much more important and they have a more stable means of checking it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top