From 55a8c991ad329bdc53edfcd03722016474be9ec0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 18 Mar 2008 18:59:37 -0500 Subject: [PATCH] fix gmt-offset on windows --- extra/calendar/windows/windows.factor | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/extra/calendar/windows/windows.factor b/extra/calendar/windows/windows.factor index 1609b9f260..6986902ff1 100755 --- a/extra/calendar/windows/windows.factor +++ b/extra/calendar/windows/windows.factor @@ -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" - ! 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" + 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 ;