-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
now()
raises warning re: unrecognized time zone
#945
Comments
I haven't tried the fix attempts listed in #928, but I'm also seeing inconsistency with warnings and timezones, and still don't know if these two issues are fundamentally linked, so I'll add a bit more to this thread (though it may help provide insight over there, too?). The order in which I make some lubridate calls seems to matter. Here's an example clean session (no .Rprofile or other custom settings) and these are the first two commands given to R: lubridate::now("America/Denver")
# [1] "2021-01-17 22:36:19 MST"
lubridate::now()
# [1] "2021-01-17 22:36:22 MST" Works just fine. Now here's another clean session with those two commands reversed in order: lubridate::now()
# [1] "2021-01-17 22:37:09 MST"
# Warning message:
# In with_tz(Sys.time(), tzone) : Unrecognized time zone ''
lubridate::now("America/Denver")
# [1] "2021-01-17 22:37:12 MST"
# Warning message:
# In with_tz(Sys.time(), tzone) : Unrecognized time zone 'America/Denver' This 'order dependence' is reproducible (on my machine). Session InfoR version 4.0.3 (2020-10-10) Platform: x86_64-apple-darwin19.6.0 (64-bit) Running under: macOS Catalina 10.15.7 Matrix products: default BLAS: /usr/local/Cellar/openblas/0.3.13/lib/libopenblasp-r0.3.13.dylib LAPACK: /usr/local/Cellar/r/4.0.3_2/lib/R/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.0.3 generics_0.1.0 Rcpp_1.0.5 lubridate_1.7.9.2 |
Could you please run:
|
@hadley So I think the only differentiator I've landed upon is the error/warning popping up when running R in an renv-ed directory. What's confusing to me is there's no specific Below are all the details, but the take-aways (to my eyes) are:
Other trivia:
In any case, from within the renv-ed R session: ## WITH renv
Sys.getenv("TZDIR")
# [1] ""
lubridate::now()
# [1] "2021-01-19 14:12:35 MST"
# Warning message:
# In with_tz(Sys.time(), tzone) : Unrecognized time zone ''
Sys.getenv("TZDIR")
# [1] "macOS"
lubridate::now("America/Denver")
# [1] "2021-01-19 14:12:42 MST"
# Warning message:
# In with_tz(Sys.time(), tzone) : Unrecognized time zone 'America/Denver' ... and now in reverse order (after restarting R): ## WITH renv
Sys.getenv("TZDIR")
# [1] ""
lubridate::now("America/Denver")
# [1] "2021-01-19 14:13:24 MST"
Sys.getenv("TZDIR")
# [1] "macOS"
lubridate::now("America/Denver")
# [1] "2021-01-19 14:13:28 MST" When run outside of my renv directory (i.e. using system libraries only): ## WITHOUT renv
Sys.getenv("TZDIR")
# [1] ""
lubridate::now()
# [1] "2021-01-19 14:15:16 MST"
Sys.getenv("TZDIR")
# [1] "/usr/share/zoneinfo"
lubridate::now("America/Denver")
# [1] "2021-01-19 14:15:28 MST" ... and the reverse order: ## WITHOUT renv
Sys.getenv("TZDIR")
# [1] ""
lubridate::now("America/Denver")
# [1] "2021-01-19 14:17:08 MST"
Sys.getenv("TZDIR")
# [1] "/usr/share/zoneinfo"
lubridate::now()
# [1] "2021-01-19 14:17:12 MST" |
Are you sure you don't have an older version of lubridate installed in your renv-ed project? |
Yeah I checked that: both the system version and renv version are 1.7.9.2. ## WITHOUT renv (i.e. system)
> packageVersion("lubridate")
[1] ‘1.7.9.2’ ## WITH renv
* Project '~/path/to/my/project' loaded. [renv 0.11.0]
> packageVersion("lubridate")
[1] ‘1.7.9.2’ As another means of double-checking, I inspected the
I've managed to work around the TZ issue in the meantime (specifically by putting some non-interactive scripts inside Docker containers ... hooray immutable infrastructure!), so it's not a big deal for my workflows, but I also want to help in whatever way I can, especially for other users (who may not have the container toolkit available to them). So with that in mind, I'm happy being a lab-rat for pinpointing issues. I'll also try to initialize a new minimal renv project and see if I can replicate. |
The behavior is as if |
@vspinu explicitly running But(!), I was able to create something much closer to a renv reprex, see below. (In all of the R sessions below, I redact the R console's startup preamble for brevity, but do provide No renv Project (silent)Create a brand new directory from the shell, switch into it, launch R and run lubridate function. In this mode, no warning is generated. $ mkdir lubridate-tz-issue
$ cd lubridate-tz-issue
$ R > lubridate::now()
[1] "2021-01-21 18:50:07 MST"
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin19.6.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /usr/local/Cellar/openblas/0.3.13/lib/libopenblasp-r0.3.13.dylib
LAPACK: /usr/local/Cellar/r/4.0.3_2/lib/R/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 generics_0.1.0 Rcpp_1.0.5 lubridate_1.7.9.2
> q()
Save workspace image? [y/n/c]: n Within renv Project (warns)In same directory, start R, init a new renv project, following the renv best-practice of restarting R after renv initialization: $ R > renv::init()
* Initializing project ...
* Discovering package dependencies ... Done!
* Copying packages into the cache ... Done!
The following package(s) will be updated in the lockfile:
# CRAN ===============================
- renv [* -> 0.12.3]
* Lockfile written to '~/tmp/lubridate-tz-issue/renv.lock'.
* Project '~/tmp/lubridate-tz-issue' loaded. [renv 0.12.3]
* renv activated -- please restart the R session.
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin19.6.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /usr/local/Cellar/openblas/0.3.13/lib/libopenblasp-r0.3.13.dylib
LAPACK: /usr/local/Cellar/r/4.0.3_2/lib/R/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3 renv_0.12.3
> q()
Save workspace image? [y/n/c]: n Restarting R, installing lubridate into the renv project, and running $ R * Project '~/tmp/lubridate-tz-issue' loaded. [renv 0.12.3]
> renv::install("lubridate")
Installing generics [0.1.0] ...
OK [linked cache]
Installing Rcpp [1.0.6] ...
OK [linked cache]
Installing lubridate [1.7.9.2] ...
OK [linked cache]
> lubridate::now()
[1] "2021-01-21 18:57:56 MST"
Warning message:
In with_tz(Sys.time(), tzone) : Unrecognized time zone ''
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin19.6.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /usr/local/Cellar/openblas/0.3.13/lib/libopenblasp-r0.3.13.dylib
LAPACK: /usr/local/Cellar/r/4.0.3_2/lib/R/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 generics_0.1.0 tools_4.0.3 Rcpp_1.0.6
[5] lubridate_1.7.9.2 renv_0.12.3
> q()
Save workspace image? [y/n/c]: n As seen in the [EDIT] ... oh, and finally, with $ R * Project '~/tmp/lubridate-tz-issue' loaded. [renv 0.12.3]
> lubridate:::.onLoad()
> lubridate::now()
[1] "2021-01-21 19:04:04 MST"
Warning message:
In with_tz(Sys.time(), tzone) : Unrecognized time zone '' Other Notes/ObservationsA few other things things that I've checked and to note about the two scenarios (renv and non-renv):
|
So I can confirm that the most recent GitHub Apologies for not trying to build from that branch earlier! Also worth noting that (Since so many packages' sources are managed by git/GitHub, it'd be neat if at some point there was the option to include the commit hash on the package description page.) As always, thanks much for everything! |
This is a novel warning (that I only just detected while testthat-ing a package update):
R 4.0.3, Mac OS 10.15.7.
Unfortunately, I don't know when (re: the various versions above) this showed up ... it seems like it might be related to #928, though even with the warning above the resultant output is indeed in the appropriate timezone (MST for me).
The text was updated successfully, but these errors were encountered: