What happens to at jobs across the DST switch?
Colin Watson
cjwatson at ubuntu.com
Fri Mar 26 17:57:04 UTC 2021
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.
--
Colin Watson (he/him) [cjwatson at ubuntu.com]
More information about the ubuntu-users
mailing list