Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when CreateWaitableTimer is set for non-existing date/time?

The Daylight Saving Time (United States) in 2013 began at 2:00 AM on Sunday, March 10. So, say, now is March 9, 2013 and I call the following API on an already created waitable timer handle:

FILETIME ftWhen = //Points as absolute time to March 10th, 2013, at 2:10 AM
SetWaitableTimer(hTimer, ftWhen, 0, NULL, NULL, TRUE);

March 10th, 2013, 2:10 AM is a non-existent time because the time will be adjusted one hour ahead so instead of 2 AM it will be 3 AM.

So my question, what will happen to my timer? (I can't seem to find documentation for this case.)

like image 290
c00000fd Avatar asked Apr 07 '13 09:04

c00000fd


2 Answers

I suspect you already know the answer to your question, because your comment explicitly states:

// Points _as absolute time_ to March 10th, 2013, at 2:10 AM

So you're aware that the documentation for SetWaitableTimer() says:

Be sure to use a UTC-based absolute time, as the system uses UTC-based time internally.

Since UTC does not care about DST whatsoever, your timer will be triggered on March 10th, 2013, 3:10 AM, your local time.

like image 131
Frédéric Hamidi Avatar answered Nov 10 '22 03:11

Frédéric Hamidi


SetWaitableTimer expects the pDueTime to be given in UTC; so there's no way to call it with such a non-existing date/time.

like image 3
Daniel Avatar answered Nov 10 '22 03:11

Daniel