开发者

Is UTC or local time used with time-based notifications?

开发者 https://www.devze.com 2022-12-23 18:59 出处:网络
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_T

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

0

精彩评论

暂无评论...
验证码 换一张
取 消