From: Hiroshi Inoue <inoue@tpf.co.jp>
To: ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
To: Magnus Hagander <magnus@hagander.net>
Cc: Hiroshi Saito <z-saito@guitar.ocn.ne.jp>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Solve a problem of LC_TIME of windows.
Date: Fri, 09 Jan 2009 06:31:48 +0900
Message-ID: <496670C4.7090209@tpf.co.jp> (raw)
In-Reply-To: <20090108113242.8B96.52131E4D@oss.ntt.co.jp>
References: <20090107140111.810A.52131E4D@oss.ntt.co.jp>
<4964AD2D.7060009@hagander.net>
<20090108113242.8B96.52131E4D@oss.ntt.co.jp>
ITAGAKI Takahiro wrote:
> Magnus Hagander <magnus@hagander.net> wrote:
>
>> ITAGAKI Takahiro wrote:
>>> Ok, wcsftime() requries both LC_TIME and LC_CTYPE are the same setting
>>> (at least encoding) on Windows.
>>>
>> Hmm. Is this actually cleaner than using the original method as
>> suggested? Because if I understand things right, that version did *not*
>> require the setting of LC_CTYPE? (this is the version that uses strftime
>> and does two conversions)
>
> No, we can't. I found strftime doesn't work if the database is
> initialized with non-C locale. It works only when lc_ctype = C and
> the encoding of lc_time is matched with Windows' one.
> On the other hand, wcsftime seems to be more robust.
> (The reason might come from mysterious msvcrt implementation.)
The setting of LC_CTYPE acts like a catalyst for wcsftime() to
work safely.
I checked the code around the patch and found the central function
cache_locale_time() is rarely called (at most once per LC_TIME change).
The function cache_locale_time() calls strftime() only 38(=7*2+12*2)
times. Now I fundamentally agree with Itagaki-san's patch. Though
it may not be the most effective code, it looks like the clearest one.
regards,
Hiroshi Inoue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-patches@postgresql.org
Cc: inoue@tpf.co.jp, itagaki.takahiro@oss.ntt.co.jp, magnus@hagander.net, z-saito@guitar.ocn.ne.jp, pgsql-hackers@postgresql.org
Subject: Re: Solve a problem of LC_TIME of windows.
In-Reply-To: <496670C4.7090209@tpf.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox