diff --git a/NEWS.md b/NEWS.md index 61381319..a86353d2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,8 @@ seconds (configurable with `cli.progress_llm_interval`), plus a final line. This is implemented by the new `llm` progress handler. +* The `logger` progress handler and the `pb_timestamp` progress variable now report timestamps in UTC, matching their `+00:00` suffix. Previously they used local time. + * New `cli_extract_vars()` function to extract variable and function names from cli format strings without evaluating them (#750, @MichaelChirico). diff --git a/R/utils.R b/R/utils.R index 7e2cf22a..03f85517 100644 --- a/R/utils.R +++ b/R/utils.R @@ -3,7 +3,7 @@ is_yes <- function(x) { } format_iso_8601 <- function(p) { - format(p, "%Y-%m-%dT%H:%M:%S+00:00") + format(p, "%Y-%m-%dT%H:%M:%S+00:00", tz = "UTC") } has_packages <- function(pkgs) { diff --git a/tests/testthat/_snaps/progress-handler-logger.md b/tests/testthat/_snaps/progress-handler-logger.md index ad33c982..03b06edc 100644 --- a/tests/testthat/_snaps/progress-handler-logger.md +++ b/tests/testthat/_snaps/progress-handler-logger.md @@ -3,5 +3,5 @@ Code logger_out(bar, "updated") Output - 2021-06-10T13:51:05+00:00 id 13/113 updated + 2021-06-10T11:51:05+00:00 id 13/113 updated diff --git a/tests/testthat/test-progress-handler-logger.R b/tests/testthat/test-progress-handler-logger.R index 74f378df..f4932d8f 100644 --- a/tests/testthat/test-progress-handler-logger.R +++ b/tests/testthat/test-progress-handler-logger.R @@ -3,6 +3,8 @@ test_that("loggerr_out", { bar$id <- "id" bar$current <- 13 bar$total <- 113 - local_mocked_bindings(Sys.time = function() .POSIXct(1623325865, tz = "CET")) + local_mocked_bindings(Sys.time = function() { + .POSIXct(1623325865, tz = "Europe/Berlin") + }) expect_snapshot(logger_out(bar, "updated")) })