New package gettz on CRAN
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
gettz is now on CRAN in its initial release 0.0.1.
It provides a possible fallback in situations where Sys.timezone()
fails to determine the system timezone. That can happen when e.g. the file /etc/localtime
somehow is not a link into the corresponding file with zoneinfo data in, say, /usr/share/zoneinfo
.
Duane McCully provided a nice StackOverflow answer with code that offers fallbacks via /etc/timezone
(on Debian/Ubuntu) or /etc/sysconfig/clock
(on RedHat/CentOS/Fedora, and rumour has it, BSD* systems) or /etc/TIMEZONE
(on Solaris). The gettz micro-package essentially encodes that approach so that we have an optional fallback when Sys.timezone()
comes up empty.
In the previous paragraph, note the stark absense of OS X where there seems nothing to query, and of course Windows. Contributions for either would be welcome.
For questions or comments use the issue tracker off the GitHub repo.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.