[Mono-dev] TimeZone/RegionInfo patches

Kornél Pál kornelpal at hotmail.com
Tue Sep 20 05:02:17 EDT 2005


Hi,

> 2) TZ environment variable support on Win32. If TZ environment
> variable is set, then it uses posix-compat timezone names
> (its behavior depends on mingw though).

I don't think that this is a good idea. Time zone is used to convert local
time to UTC so if TZ contains a time zone other than that Windows uses you
will assume wrong offset of local time and will get a wrong UTC value.

I have never used mingw but using TZ environment variable should be done
only if mingw provides local time converted to TZ offset using it's own
runtime functions instead of a local time based on the Windows time zone
offset.

> 3) tiny change on RegionInfo.CurrentRegion to construct
> apart from CultureInfo. In fact I have further patch to store
> it inside Thread (as once Kornel suggested) but it is not
> working perfectly now, so I just extracted minimal working part.
> (This looks like independent but it shares a function with 1).

I never suggested to store current region inside Thread.:) Current region
should be stored in a static field of RegionInfo and should be initialized
when CurrentRegion is called for the first time and it should be the same
inside the entire AppDomain until CultureInfo.ClearCachedData() is called
that clear cached data that will be reinitialized when next time
CurrentRegion is called.

On Windows CurrentRegion and CurrentCulture sould be initialized based on
the value of GetUserDefaultLCID as it may change without restart.
CurrentUICulture should be initialized based on GetUserDefaultUILanguage.
But after their singleton instance was created on the first query they
should not be modified. On Posix some functionally equivalent value should
be used.

For more information:
http://lists.ximian.com/pipermail/mono-devel-list/2005-August/014128.html

4) And I think parsing locale name in get_current_locale_id is not required
at least on Windows as it returns current locale as an LCID that currently
is converted to a name then it is coverted back to and LCID.

The functionality of the other parts looks OK to me.

Kornél

----- Original Message -----
From: "Atsushi Eno" <atsushi at ximian.com>
To: <mono-devel-list at lists.ximian.com>
Sent: Friday, September 16, 2005 7:30 AM
Subject: [Mono-dev] TimeZone/RegionInfo patches


> Hi,
>
> I made a set of patches for a few globalization related stuff.
>
> 1) native TimeZone name support. Now it returns native names
> as long as they are provided by the locale-builder.
>
> Am also planning to update locale data to the latest version
> of CLDR (it has much more timezone names than existing one).
>
> 2) TZ environment variable support on Win32. If TZ environment
> variable is set, then it uses posix-compat timezone names
> (its behavior depends on mingw though).
>
> 3) tiny change on RegionInfo.CurrentRegion to construct
> apart from CultureInfo. In fact I have further patch to store
> it inside Thread (as once Kornel suggested) but it is not
> working perfectly now, so I just extracted minimal working part.
> (This looks like independent but it shares a function with 1).
>
> Comments are welcome :-)
>
> Atsushi Eno
>
>


--------------------------------------------------------------------------------


> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>




More information about the Mono-devel-list mailing list