Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJDAfTDpBrooMDDJ=p1xf5c_j6Rn9nAuAnBCvdotzUcgBkQRzA@mail.gmail.com>
Date: Thu, 4 Feb 2016 13:27:40 -0200
From: Alba Pompeo <albapompeo@...il.com>
To: musl@...ts.openwall.com
Cc: Martin Maechler <maechler@...t.math.ethz.ch>
Subject: strptime() question

Hello musl.

I've built R on a musl system and "make check-all" fails because R
does not get correct timezone information from the system.

Here's the error -
http://pastebin.com/raw/32D3ngNZ

This would be correct,

> difftime(
+     as.POSIXct(c("1970-01-01 00:00:00", "1970-01-01 12:00:00"), tz="EST5EDT"),
+     as.POSIXct(c("1970-01-01 00:00:00", "1970-01-01 00:00:00"), tz="UTC"))
Time differences in hours
[1]  5 17

but my system gives   4 16  which would suggest that it thinks that
there is only 4 hours time difference between  UTC  and  EST5EDT and
that is just wrong.

The above can be translated to this (slightly more low-level) R code which
is already somewhat close to the internal C code of R :

  > t0 <- strptime("1970-01-01 00:00:00", "%Y-%m-%d %H:%M:%OS", tz="UTC")
  > as.numeric(t0)
  [1] 0

  > t1 <- strptime("1970-01-01 00:00:00", "%Y-%m-%d %H:%M:%OS", tz="EST5EDT")
  > as.numeric(t1)
  [1] 18000
  > 18000 / 3600
  [1] 5
  >

That's why its 5 hours.
R's  strptime()  is close to the C library  strptime(), so think musl
specialists should have it easy to do the above from C and find out
why you get 4 hour instead of 5 hour difference.

I'm certain this isn't a problem with R and I think it's up to me to
ensure that your system's  C library strptime() function returns the
correct numbers for the above example, but I can't understand why it
doesn't.

Can anyone help here?
Thanks a lot.

Ciao.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.