Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How does `at` know there will be a time change?

What was going on? Well – it turns out today daylight saving time ended in Norway (summer time), so indeed 2:41 happened twice tonight! And sure enough, at the second one (i.e. 3:41 as seen from summer time), at then fired off those scheduled events.

How does this work? Why and how is the scheduling aware of time change, and picks the second time around, rather than just doing it when the time passes the specified one?
by

1 Answer

Bharatgxwzm
at attempts to parse the date and time given and runs it through mktime() with "Daylight Saving Time" set to -1 (not available, auto-detect).

at source code:

tm1.tm_isdst = -1;
t = mktime (&tm1);
man 3 mktime:


So mktime() decides whether DST is or is not in effect; and it seems to prefer the later date out of two possible choices (although it's not clear from documentation how that decision is made).

Login / Signup to Answer the Question.