gettz v0.0.3


Monthly downloads



Get the Timezone Information

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.


gettz Build Status License CRAN Downloads

Get System Timezone Information


Many date and time conversion need information about the local timezone. It is common to set the environment variable TZ. However, sometimes it is unset, and we need a fallback. Or maybe we just want a fallback to not always have to set the TZ variable by hand.

R has a helper function Sys.timezone() which queries the system timezone information. Sadly, we have seen it fail (possibly because /etc/localtime was not a symbolic link as it expected, but rather a copy of the corresponding (local) timezone metadata). Another issue is, once again, that the code which R uses here is sadly not accessible to users via a callable API for C or C++. So there is a need for something different---and Duane McCully provided just that in this StackOverflow answer. This package essentially adapted his code to be callable from R.


Works on Linux, expected to also work on Solaris and BSD, builds on OS X but only returns NULL due to the apparent lack of any programmatic interface.

Windows could possibly be supported by querying the registry.


The package is now on CRAN and can be installed via a standard

R> install.packages("gettz")

provided you are on a Unix system.


Dirk Eddelbuettel


GPL (>= 2)

Functions in gettz

Name Description
gettz-package \Sexpr[results=rd,stage=build]{tools:::Rd_package_title("#1")}gettzGet the Timezone Information
No Results!

Last month downloads


Type Package
Date 2016-11-05
License GPL (>= 2)
RoxygenNote 5.0.1
NeedsCompilation yes
Packaged 2016-11-05 13:13:24.914588 UTC; edd
Repository CRAN
Date/Publication 2016-11-05 20:56:39
Contributors Dirk Eddelbuettel

Include our badge in your README