From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9260 Path: news.gmane.org!not-for-mail From: Alba Pompeo Newsgroups: gmane.linux.lib.musl.general Subject: strptime() question Date: Thu, 4 Feb 2016 13:27:40 -0200 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1454601610 29550 80.91.229.3 (4 Feb 2016 16:00:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Feb 2016 16:00:10 +0000 (UTC) Cc: Martin Maechler To: musl@lists.openwall.com Original-X-From: musl-return-9273-gllmg-musl=m.gmane.org@lists.openwall.com Thu Feb 04 17:00:08 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aRMKF-0004Bh-O4 for gllmg-musl@m.gmane.org; Thu, 04 Feb 2016 17:00:07 +0100 Original-Received: (qmail 21678 invoked by uid 550); 4 Feb 2016 16:00:04 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 30033 invoked from network); 4 Feb 2016 15:27:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=OvUFYvplllIE3K4OFfYkcHsXQR/3spZaDfZXajS3Nh8=; b=WUGJNXeDsfbJQ0EhVKsZd0ACMlguSORtmJ8nGiABj2KcaLkFmu6lAKTz7KztJdUtq9 kkw93fcB6vpDV+Y+EOYNEHOTbRFfjAW4eO08Gu++rULJM9e9b7kYuj7wwo/anMPg59SJ hx/ut1DStKee51RVQAC4sRL6dF5Ph8wiCnyYKi2JLZ4BfwXGwx3h6que0NXnTEvbeKYu +VzYXy+RXyO8d88lGJ3f1oRjI8FERcljar0/glJVmtSsp7IIWdD4IM+8NByGmxqXwTwP lkg0rN9E5S9cLsaTMLuy4/S0zTQxBfKf2DBZ0y869Ft36XYS+II1l4OX7Jwml2R86ztL QCuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=OvUFYvplllIE3K4OFfYkcHsXQR/3spZaDfZXajS3Nh8=; b=OVT0ISiEgarknsdfvTANGxSMs71CTm05V8avyzfTsjA2MOGOzXUUTxMB7rQ0/BzDFy fOAbl/nIbcgxOAkWkKMasf16NNhS0SnwidaQ49Lj1vBnEyI3+8SXKVK97kygkHrLSOMe ZXgfQ6YW+w5Mrzi7FTXzqkBRZ8bxnCUQeXEuHDYRSv1whCh7LAxZP6607SfbATph7x6x 2h4atXUK8Qu5ADNO256NCWuizYtgCNvE2JxIwkQ05UCx8j2llaOyACZSNNQ1W8LMtQwG L3M5NfzHEX12YCGHovG+C7r+BJHw3oFLdItX/NSH9tVW2mQmfp78A1hVPbw7FtPMex20 YiWw== X-Gm-Message-State: AG10YORrNYRpn+t3pbcyDc7pHqNQLg3EdlhJS3Alf2Qy8TrBLDxDLkQPcYA205PsN8Rc1Po8TTleK50rblmxJw== X-Received: by 10.28.47.9 with SMTP id v9mr4927634wmv.69.1454599660359; Thu, 04 Feb 2016 07:27:40 -0800 (PST) Xref: news.gmane.org gmane.linux.lib.musl.general:9260 Archived-At: 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.