Hi there, The following codes may cause the problem in R 4.3.0 on FreeBSD in my last post: Error in as.POSIXlt.character(x, tz, ...) > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = "")) [1] "1970-01-01 12:00:00 CST" > is.na(d) [1] TRUE In R 4.3.0 on windows, > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = "")) [1] "1970-01-01 12:00:00 CST" > is.na(d) [1] FALSE The only difference is the result of is.na(). Best, Jinsong
? Thu, 11 May 2023 22:15:49 +0800 Jinsong Zhao <jszhao at yeah.net> ?????:> > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz > > = "")) > [1] "1970-01-01 12:00:00 CST" > > is.na(d) > [1] TRUEGlad to see you're making progress! (Sometimes, is.na(strptime(...)) =TRUE is what progress looks like.) is.na.POSIXlt works by converting the "unpacked" date+time into POSIXct (seconds since 1970-01-01 00:00 UTC) and then checking whether it's NA. Evidently, as.POSIXct(d) returns NA. (Right?) What does unclass(d) look like on FreeBSD? Does it contain any NAs itself, or do they originate somewhere in as.POSIXct(d)? My current hypothesis is that FreeBSD mktime() doesn't like something about the timezone, but I may be wrong. Is is.na(strptime( "1970-01-03 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = '')) also TRUE? -- Best regards, Ivan
Am 11.05.23 um 16:15 schrieb Jinsong Zhao:> Hi there, > > The following codes may cause the problem in R 4.3.0 on FreeBSD in my > last post: Error in as.POSIXlt.character(x, tz, ...) > > > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = > "")) > [1] "1970-01-01 12:00:00 CST" > > is.na(d) > [1] TRUE > > In R 4.3.0 on windows, > > > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = > "")) > [1] "1970-01-01 12:00:00 CST" > > is.na(d) > [1] FALSE > > The only difference is the result of is.na(). > > Best, > JinsongI can't confirm, that is.na(d) returns TRUE on FreeBSD. On my boxes it always gives > (d <- strptime("1970-01-01 12:00:00 UTC", "%Y-%m-%d %H:%M:%OS", tz = "")) [1] "1970-01-01 12:00:00 CET" > is.na(d) [1] FALSE # uname ... 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n262658-b347c2284603: Sat Apr 29 11:20:31 CEST 2023 Best wishes, Rainer