fix gmt-offset on windows

db4
Doug Coleman 2008-03-18 18:59:37 -05:00
parent 693f3b9193
commit 55a8c991ad
1 changed files with 13 additions and 14 deletions

View File

@ -1,22 +1,21 @@
USING: calendar.backend namespaces alien.c-types
windows windows.kernel32 kernel math ;
windows windows.kernel32 kernel math combinators.cleave
combinators ;
IN: calendar.windows
TUPLE: windows-calendar ;
T{ windows-calendar } calendar-backend set-global
: TIME_ZONE_ID_INVALID HEX: ffffffff ; inline
M: windows-calendar gmt-offset ( -- hours minutes seconds )
0 0 0 ;
! "TIME_ZONE_INFORMATION" <c-object>
! dup GetTimeZoneInformation {
! { [ dup TIME_ZONE_ID_INVALID = ] [ win32-error ] }
! { [ dup { TIME_ZONE_ID_UNKNOWN TIME_ZONE_ID_STANDARD } member? ]
! [ TIME_ZONE_INFORMATION-Bias 60 / neg ] }
! { [ dup TIME_ZONE_ID_DAYLIGHT = ] [
! [ TIME_ZONE_INFORMATION-Bias 60 / neg ]
! [ TIME_ZONE_INFORMATION-DaylightBias ] bi
! ] }
! } cond ;
"TIME_ZONE_INFORMATION" <c-object>
dup GetTimeZoneInformation {
{ [ dup TIME_ZONE_ID_INVALID = ] [ win32-error-string throw ] }
{ [ dup [ TIME_ZONE_ID_UNKNOWN = ] [ TIME_ZONE_ID_STANDARD = ] bi or ] [
drop TIME_ZONE_INFORMATION-Bias ] }
{ [ dup TIME_ZONE_ID_DAYLIGHT = ] [
drop
[ TIME_ZONE_INFORMATION-Bias ]
[ TIME_ZONE_INFORMATION-DaylightBias ] bi +
] }
} cond neg 60 /mod 0 ;