Skip to content

Commit

Permalink
amend comment: not all linux-based systems have systemd
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87819 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Feb 25, 2025
1 parent 615712b commit d8aa7af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/library/base/R/datetime.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ Sys.timezone <- function(location = TRUE)
} else tzdir <- ""
}

## First try timedatectl: should work on any modern Linux
## as part of systemd (and probably nowhere else)
## First try timedatectl: should work on any modern (post 2015)
## glibc-based Linux as part of systemd (and probably nowhere else)
## https://www.freedesktop.org/software/systemd/man/sd_booted.html
## systemd is (in 2025) an optional part of musl
if (dir.exists("/run/systemd/system") && nzchar(Sys.which("timedatectl"))) {
inf <- system("timedatectl", intern = TRUE)
## typical format:
Expand Down

0 comments on commit d8aa7af

Please sign in to comment.