[Vm-dev] Timezones in LocalePlugin
Bert Freudenberg
bert at freudenbergs.de
Fri Aug 29 11:05:32 UTC 2008
Am 28.08.2008 um 18:58 schrieb Andreas Raab:
> Hi Bert -
>
> Looks like we're in violent agreement (Brad's note attached).
Great!
> I checked in the fix for the Windows VM and here is the code that we
> use in the Unix locale plugin:
>
> sqInt sqLocGetVMOffsetToUTC(void) {
> return 0;
> }
>
> sqInt sqLocGetTimezoneOffset(void) {
> struct tm * timeBlock;
> time_t theTime;
> theTime = time((time_t)NULL);
> timeBlock = localtime(&theTime);
> return timeBlock->tm_gmtoff / 60;
> }
>
> sqInt sqLocDaylightSavings(void) {
> struct tm * timeBlock;
> time_t theTime;
> theTime = time((time_t)NULL);
> timeBlock = localtime(&theTime);
> return timeBlock->tm_isdst;
> }
Mine looks pretty similar. It's written to be the reverse of
convertToSqueakTime() which is special-cased to work across a variety
of Unices (tm_gmtoff is a BSDism, also in glibc, but not strict ISO C).
I'll fix the DST function too, didn't need it for now.
Btw, in the OLPC image we use it like this:
http://tinlizzie.org/updates/etoys/updates/2092LocalePluginAddins-tpr.cs
http://tinlizzie.org/updates/etoys/updates/2106chronologyUnix-bf.cs
Do you use other functions from the locale plugin? I noticed at least
the format methods are not correct under Linux, too ...
- Bert -
More information about the Vm-dev
mailing list