From dalias at libc.org  Sat Feb  6 23:55:23 2016
From: dalias at libc.org (Rich Felker)
Date: Sat, 6 Feb 2016 17:55:23 -0500
Subject: [Rd] [musl] Re: Fwd:  [musl] strptime() question
In-Reply-To: <CAJDAfTDftYEGsHOyqadm-V360xh2-sL2s8qDNHfAm0Ryu=+-bg@mail.gmail.com>
References: <CAJDAfTDpBrooMDDJ=p1xf5c_j6Rn9nAuAnBCvdotzUcgBkQRzA@mail.gmail.com>
	<20160204160708.GP9349@brightrain.aerifal.cx>
	<CAJDAfTCENy0dyAYP5612OSMnNBc5U-AGjEoOgVgF1VisjDs8=g@mail.gmail.com>
	<E98A2A10-27B5-48EF-988E-506F69E84BA6@r-project.org>
	<CAJDAfTBwMx5eb5L+A2fbCpMB1ez-N+KdNViu69HkxAqfZs6RCg@mail.gmail.com>
	<20160204213249.GT9349@brightrain.aerifal.cx>
	<CAJDAfTDftYEGsHOyqadm-V360xh2-sL2s8qDNHfAm0Ryu=+-bg@mail.gmail.com>
Message-ID: <20160206225522.GX9349@brightrain.aerifal.cx>

On Sat, Feb 06, 2016 at 10:35:28AM -0200, Alba Pompeo wrote:
> It is setting TZ and using tzset(). R is not multi-threaded so it is safe.
> 
> Simon figure out the important settings from the config.log and
> config.h files on a musl system:
> 
> /* #undef USE_INTERNAL_MKTIME */
> #define HAVE_TM_GMTOFF 1
> #define HAVE_TM_ZONE 1
> 
> Does this help anyone debug the issue? Simon just went on vacation.

R's src/main/datetime.c does A LOT of munging to the output of
strptime and I wouldn't be surprised if they're making nonportable
assumptions about it. Note that the underlying C strptime function has
nothing to do with timezones or time conversion; it's basically just a
time-tailored sscanf that reads integers and strings from the input
string and converts them into values in the fields of struct tm.

It also looks like R isn't even calling the system strptime but
instead using its own R_strptime. I think that supports my theory that
the problem is in the munging being done after the string is parsed.

Rich



[Rd] [musl] Re: Fwd: [musl] strptime() question
Rich Felker