Package 'tzupdater'

Title: Time Zone Database Updater
Description: Download and compile any version of the IANA Time Zone Database (also known as Olson database) and make it current in your R session. Beware: on Windows 'Cygwin' is required!
Authors: Sebastien Thonnard
Maintainer: Sebastien Thonnard <[email protected]>
License: MIT + file LICENSE
Version: 0.1.5
Built: 2025-03-01 04:20:24 UTC
Source: https://github.com/sthonnard/tzupdater

Help Index


get_active_tz_db

Description

Get the active tz database version

Usage

get_active_tz_db()

Value

Active tz database for the current session.

Examples

# Get the active tz database in your session:
get_active_tz_db()

get_last_published_tz

Description

Get the name of the latest version available at IANA website.

Usage

get_last_published_tz()

Value

Latest IANA tz db version name or Unknown if not found.

Examples

# Will return for instance "2019c"
get_last_published_tz()

install_last_tz

Description

Install latest tz database if required, and make it active.

Will stop in case it is not possible to know what the last version is.
If it happens browse IANA website at https://www.iana.org/time-zones and install last version with install_tz(version).
?install_tz for details.

Usage

install_last_tz(
  zic_path = NA,
  target_folder = paste0(tempdir(), "/tzupdater/data/IANA_release"),
  verbose = TRUE
)

Arguments

zic_path

Optional for Windows: path to the zic compiler (if not in C:\Cygwin\usr\sbin).

target_folder

Optional target folder. Default will be tzupdater/data/IANA_release as subdirectory of your temp dir.

verbose

Print information to the console TRUE/FALSE. Default TRUE.

Value

None.

Examples

# Get the latest version available and compile. 
# If your tz database is already the latest, do nothing.
install_last_tz()

# Same, but more verbose.
install_last_tz(verbose = TRUE)

# On Windows: install latest tz database, with Cygwin installed in c:\Cygwin.
install_last_tz(zic_path="C:\\Cygwin\\usr\\sbin")

install_tz

Description

Download and compile a tz database from the IANA website and make it active as an option. In case the tz db exists already, do not download again.

Usage

install_tz(
  tgt_version = "2019c",
  zic_path = NA,
  target_folder = paste0(tempdir(), "/tzupdater/data/IANA_release"),
  show_zic_log = FALSE,
  err_stop = TRUE,
  activate_tz = TRUE,
  verbose = TRUE,
  fail_if_zic_missing = FALSE
)

Arguments

tgt_version

Version to download and compile (eg 2019c, 2019a).

zic_path

Optional for Windows: path to the zic compiler (if not in C:\Cygwin\usr\sbin)

target_folder

Optional target folder. Default will be tzupdater/data/IANA_release as in tempdir()

show_zic_log

Optional: show logs from the zic compiler (TRUE/FALSE). Default FALSE.

err_stop

Stop on error (TRUE/FALSE). Default TRUE. Recommanded to TRUE.

activate_tz

Activate the tz database once installed. Default TRUE.

verbose

Print additional information to the console TRUE/FALSE. Default TRUE.

fail_if_zic_missing

Stop execution if zic is missing (default FALSE, will only display a message)

Examples

# Install tz database 2019c
install_tz("2019c")