| Type: | Package |
| Title: | Get the Timezone Information |
| Version: | 0.0.6 |
| Date: | 2026-08-25 |
| Description: | A function to retrieve the system timezone on Unix systems which has been found to find an answer when 'Sys.timezone()' has failed. It is based on an answer by Duane McCully posted on 'StackOverflow', and adapted to be callable from R. The package also builds on Windows, but just returns NULL. The functionality it offers was not available in R when the package was written, but has since been added which reduces the need for this package. |
| URL: | https://github.com/eddelbuettel/gettz/, https://dirk.eddelbuettel.com/code/gettz.html |
| BugReports: | https://github.com/eddelbuettel/gettz/issues |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| RoxygenNote: | 5.0.1 |
| NeedsCompilation: | yes |
| Packaged: | 2026-08-25 12:27:03 UTC; edd |
| Author: | Dirk Eddelbuettel |
| Maintainer: | Dirk Eddelbuettel <edd@debian.org> |
| Repository: | CRAN |
| Date/Publication: | 2026-08-25 12:40:26 UTC |
Get the Timezone Information
Description
A function to retrieve the system timezone on Unix systems which has been found to find an answer when 'Sys.timezone()' has failed. It is based on an answer by Duane McCully posted on 'StackOverflow', and adapted to be callable from R. The package also builds on Windows, but just returns NULL. The functionality it offers was not available in R when the package was written, but has since been added which reduces the need for this package.
Usage
gettz()
Details
R has a function Sys.timezone which tries hard to
retrieve the same information. However, we have found instances
where it failed to provide an answer—whereas the simple code in
this package does.
This package provides a single function gettz which looks
at /etc/timezone (on Debian/Ubuntu), /etc/sysconfig/clock
(on RedHat/CentOS/Fedora) or /etc/TIMEZONE (on Solaris).
In case no information can be provided, NULL is returned.
Windows support is bare-bones: the package builds, but does not do anything. One could probably deploy custom code to query the registry but given that R already does this, there is no imminent need.
Well after the package was created, R added functionality for retrieving timezone information making its approach more robust and reducing the need for this package.
Author(s)
Dirk Eddelbuettel [aut, cre] (ORCID: <https://orcid.org/0000-0001-6419-907X>)
References
https://stackoverflow.com/a/33881726/143305
Examples
gettz()