tests/testthat/helper-in-time-zone.R

inTimeZone <- function(tz, code) {
  previous_tz <- currentTimeZone()
  tryCatch({
    Sys.setenv(TZ=tz)
    eval(code)
  }, finally={
    Sys.setenv(TZ=previous_tz)
  })
}

currentTimeZone <- function() {
  Sys.getenv("TZ", Sys.timezone())
}

Try the dbx package in your browser

Any scripts or data that you put into this service are public.

dbx documentation built on June 22, 2024, 9:11 a.m.