Skip to content
Prev 3139 / 3656 Next

Timezone conversion on Ubuntu 20.04

On Sat, Apr 25, 2020 at 10:41 AM Johannes Ranke <johannes.ranke at jrwb.de> wrote:
Perhaps the root cause of the change in behavior is that on the
focal/bullseye docker images, /usr/bin/timedatectl exists, but it does
not work:

   root at focal:/# timedatectl
   System has not been booted with systemd as init system (PID 1).
Can't operate.
   Failed to create bus connection: Host is down

R assumes that if it timedatectl exists, it can be used. On the docker
image of bionic and buster, timedatectl simply is not installed so R
does not call it.

The consequence though, is very subtle changes in behavior of time
conversion edge cases that I cannot explain. For example we get
differences between "UTC" and "Etc/UTC":
[1] "Etc/UTC"
# System has not been booted with systemd as init system (PID 1). Can't operate.
# Failed to create bus connection: Host is down
Warning message:
In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 1

as.POSIXct(strptime("24.04.2020 01:00", format = "%d.%m.%Y %H:%M", tz
= "CET"), tz = "")
[1] NA

as.POSIXct(strptime("24.04.2020 01:00", format = "%d.%m.%Y %H:%M", tz
= "CEST"), tz = "")
[1] "2020-04-24 01:00:00 UTC"
[1] NA
[1] "2020-04-24 01:00:00 UTC"