Hi there, When I run the following code in R 4.3.0 on FreeBSD, I got error. > as.POSIXct("1970-01-01 00:00.00 UTC") Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format The same code could give correct answer in R 4.3.0 on Windows, and R 4.1.2 on a old CentOS. > as.POSIXct("1970-01-01 00:00.00 UTC") [1] "1970-01-01 CST" I confirmed that all the 3 OSes give the same time zone: > Sys.timezone() [1] "Asia/Shanghai" What's wrong with the R on FreeBSD? Any hint? Thanks in advance. Best, Jinsong
? Thu, 11 May 2023 16:56:41 +0800 Jinsong Zhao <jszhao at yeah.net> ?????:> When I run the following code in R 4.3.0 on FreeBSD, I got error. > > > as.POSIXct("1970-01-01 00:00.00 UTC") > Error in as.POSIXlt.character(x, tz, ...) : > character string is not in a standard unambiguous formatDo strptime("1970-01-01 00:00.00 UTC", "%Y-%m-%d %H:%M", '') and strptime("1970-01-01 00:00.00 UTC", "%Y-%m-%d", '') both return NA for you on FreeBSD? If not, can you trace the execution using R's debugger to see which parts are returned as NA, failing the test in as.POSIXlt.character? I think that strptime() should have discarded the trailing parts of the string and matched at least the beginning (though not the ".00 UTC" part because it doesn't correspond to the formats tried by strptime()). Moreover, there shouldn't be significant difference between the platforms, because R seems to always use an internal implementation of strptime(). Are you using a multi-byte locale? (What's your sessionInfo() on both a system where it works and the system where it fails?) -- Best regards, Ivan
I find your claim suspect... a period is not interchangeable with a colon. On May 11, 2023 1:56:41 AM PDT, Jinsong Zhao <jszhao at yeah.net> wrote:>Hi there, > >When I run the following code in R 4.3.0 on FreeBSD, I got error. > >> as.POSIXct("1970-01-01 00:00.00 UTC") >Error in as.POSIXlt.character(x, tz, ...) : > character string is not in a standard unambiguous format > >The same code could give correct answer in R 4.3.0 on Windows, and R 4.1.2 on a old CentOS. > >> as.POSIXct("1970-01-01 00:00.00 UTC") >[1] "1970-01-01 CST" > >I confirmed that all the 3 OSes give the same time zone: >> Sys.timezone() >[1] "Asia/Shanghai" > >What's wrong with the R on FreeBSD? Any hint? Thanks in advance. > >Best, >Jinsong > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.
The origin of this problem is when I try to update rstan package in R 4.3.0 on FreeBSD. I get the same error as that https://github.com/stan-dev/rstan/issues/612 However, I did not encounter this problem when using R 4.2.x or 4.1.x on FreeBSD. Best, Jinsong On 2023/5/11 16:56, Jinsong Zhao wrote:> Hi there, > > When I run the following code in R 4.3.0 on FreeBSD, I got error. > > > as.POSIXct("1970-01-01 00:00.00 UTC") > Error in as.POSIXlt.character(x, tz, ...) : > ? character string is not in a standard unambiguous format > > The same code could give correct answer in R 4.3.0 on Windows, and R > 4.1.2 on a old CentOS. > > > as.POSIXct("1970-01-01 00:00.00 UTC") > [1] "1970-01-01 CST" > > I confirmed that all the 3 OSes give the same time zone: > > Sys.timezone() > [1] "Asia/Shanghai" > > What's wrong with the R on FreeBSD? Any hint? Thanks in advance. > > Best, > Jinsong