Is UTC or local time used with time-based notifications?
I have a time in the future when I want a notification to occur and need to know if ::CeSetUserNotification开发者_运维技巧Ex
expects UTC or local time in the stStartTime
field of the CE_NOTIFICATION_TRIGGER
structure if the dwType
field is set to CNT_TIME
?
After actually testing ::CeSetUserNotificationEx
with both UTC and local time input, I'm in the position of answering my own question:
::CeSetUserNotificationEx
wants local time.
Use ::GetSystemTime() to fill up your stStartTime param, convert it to FILETIME through ::SystemTimeToFileTime(), cast the resulting FILETIME structure to a ULARGE_INTEGER structure, add the relevant milliseconds interval, cast back to FILETIME, convert to your stEndTime param with ::FileTimeToSystemTime().
See http://msdn.microsoft.com/en-us/library/aa908737.aspx for FILETIME arithmetics
精彩评论