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 -