What happens to at jobs across the DST switch?

Karl Auer kauer at biplane.com.au
Sat Mar 27 01:37:28 UTC 2021


On Sat, 2021-03-27 at 12:20 +1100, Karl Auer wrote:
> It looks as if "at" is mishandling timezone

I found this very old bug which looks very similar:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=364975

In the discussion of that bug I found a workaround - set the timezone
to UTC before running at. These are my results which are exactly as
expected and desired.

kauer at kt1:~$ TZ=UTC at 1:27 today
warning: commands will be executed using /bin/sh
at> date > /tmp/at.txt
at> <EOT>
job 12 at Sat Mar 27 01:27:00 2021
kauer at kt1:~$ atq
12	Sat Mar 27 12:27:00 2021 a kauer
kauer at kt1:~$ date
Sat 27 Mar 2021 12:27:22 AEDT
kauer at kt1:~$ cat /tmp/at.txt
Sat 27 Mar 2021 01:27:00 UTC

So you can probably get everything working as you wish by simply
setting "TZ=UTC" at the top of all your scripts, and using UTC
everywhere.

BUT: I don't know whether at will properly calculate the time *for the
hour of changeover". Something for you to test. If the clocks go
forward at 2am where you are, set a task for 1:15 UTC on that day. It
should show a local time of 3:15, because at 2:00 UTC the local time
will have moved forward an hour, putting your two hours ahead in total.
I think :-)

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer

GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D







More information about the ubuntu-users mailing list