[Rd] LC_TIME not set correctly by Sys.setlocale() ?

Joris Meys jorismeys at gmail.com
Fri Jun 23 17:40:44 CEST 2017


Dear prof. Ripley,

thank you for your answer. A few additional questions below.

On Fri, Jun 23, 2017 at 5:25 PM, Prof Brian Ripley <ripley at stats.ox.ac.uk>
wrote:

> On 23/06/2017 15:35, Joris Meys wrote:
>
>> Related to the following question on Stackoverflow:
>> https://stackoverflow.com/questions/44723690/unexpected-beha
>> vior-of-sys-setlocale#44723690
>>
>> It appears as if Sys.setlocale() does not update LC_TIME correctly for use
>> in date formatting. Although R reports that LC_TIME is changed to the new
>> setting after use of Sys.setlocale(), as.Date() still uses the old
>> settings. The only way to update this is by specifically using LC_TIME.
>>
>> Is this a bug or am I overlooking something?
>>
>
> Try setting the LC_TIME category explicitly.  The mapping of day/month
> names used by strptime (not really as.Date, and not taken from LC_TIME) is
> then reset.
>

I have done so in the example, and I am aware that the underlying function
is strptime. I just wondered why setting LC_ALL did not refresh the
mapping, as LC_ALL -afaik- also updates LC_TIME to a new locale

>
> Since Windows does not have a usable strptime C function, a substitute is
> used and its handing of non-English names is not done through the OS's
> locale mechanism.


This explains the behaviour. Is there a reason why this substitute is only
updating the mapping of day/month names when LC_TIME is set explicitly and
not when LC_ALL (and hence also LC_TIME) is set?

Regards
Joris

-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel :  +32 (0)9 264 61 79
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



More information about the R-devel mailing list