Package 'gettz'

Title: 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.
Authors: Dirk Eddelbuettel [aut, cre]
Maintainer: Dirk Eddelbuettel <[email protected]>
License: GPL (>= 2)
Version: 0.0.5
Built: 2024-10-25 05:47:09 UTC
Source: https://github.com/eddelbuettel/gettz

Help Index


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.

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, there is imminent need.

Author(s)

Dirk Eddelbuettel [aut, cre] (<https://orcid.org/0000-0001-6419-907X>)

References

https://stackoverflow.com/a/33881726/143305

Examples

gettz()