What happens to at jobs across the DST switch?
Bo Berglund
bo.berglund at gmail.com
Fri Mar 26 18:50:27 UTC 2021
On Fri, 26 Mar 2021 17:57:04 +0000, Colin Watson <cjwatson at ubuntu.com> wrote:
>On Fri, Mar 26, 2021 at 06:12:10PM +0100, Bo Berglund wrote:
>> If I today create jobs to run tomorrow at for example the following times, what
>> happens?
>> i.e they are set up before the switch (today) but shall run after the switch
>> (tomorrow):
>>
>> at 00:59
>> at 01:59
>> at 02:59
>> at 03:59
>> at 04:59
>>
>> etc
>>
>> When they are set up I wonder if at is clever enough to know which time the
>> clock changes 1 hour and compensates for it so it will actually run at the
>> expected time or do the jobs set up for after the DST change run 1 hour off?
>
>Well, the question is: what is the expected time in what you wrote
>above? My interpretation would be that 02:59 would mean the next time
>that will be 02:59 in whatever daylight savings offset is in effect when
>that time is reached, rather than in the current daylight savings
>offset. Looking at the at(1) code, I think that's how it interprets it
>too: it parses the date and/or time you give it and converts it to a
>time_t (seconds since the Unix epoch), and the time_t is what actually
>gets written to the job file.
>
>> I have a complex at job creation script which has to know the time difference to
>> the USA from Europe. It is currently 5 hours CET to Eastern DST in US because US
>> switches 2 weeks ahead of us.
>> Tomorrow after 02:00 CET the time difference will be 6 hours because Europe
>> switches.
>
>I'm not sure if I completely understand the problem, but perhaps you can
>simplify things by specifying all the job start times in UTC (which you
>can do by appending " UTC" to the timespec you give to at(1))? That way
>at least the job start times will be unambiguous even if I read the code
>wrongly when writing the paragraph above, though of course you'll have
>to work out how they correspond to the system's configured civil time.
>
Thanks for the UTC suggestion!
AFAICT UTC just chugs along with no DST jumps etc.
And excuse me for the time references, I thought today was Saturday so the DST
switch would happen tonight. It is actually a day longer away....
(It is what happens when you are retired, day-of-week has no meaning anymore...)
I have at jobs that download YouTube streams at certain times nigthly in US ET
frame and the USA has switched to summer time almost 2 weeks ago at which time I
had to rewrite my script for setting up the nightly jobs so they would not be 1
hour off. And on Saturday I need to go the other way for the Sunday jobs...
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list