Guest User

Untitled

a guest
Jun 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. get_tz_list <- function() {
  2. big_list <- lapply(OlsonNames(), function(tz) {
  3. dates <- as.POSIXlt(seq(as.POSIXlt("2000-01-01 12:00:00", tz = tz),
  4. as.POSIXlt("2000-12-31 12:00:00", tz = tz),
  5. by = "1 day"))
  6. gmt_offset <- dates$gmtoff
  7. tz_code <- dates$zone
  8. is_dst <- c(NA, FALSE, TRUE)[dates$isdst + 2]
  9. gmt_offset[is.null(gmt_offset)] <- 0L
  10. tz_code[is.null(tz_code)] <- NA_character_
  11. # Possibly get start and end dates of DST?
  12. unique(data.frame(tz,
  13. tz_code,
  14. is_dst = is_dst,
  15. gmt_offset_h = gmt_offset / 3600,
  16. stringsAsFactors = FALSE))
  17. })
  18.  
  19. do.call("rbind", big_list)
  20. }
Add Comment
Please, Sign In to add comment