remove calendar-backend and use os

db4
Doug Coleman 2008-04-02 18:28:55 -05:00
parent 393f77715c
commit 28d804d2c4
3 changed files with 6 additions and 16 deletions

View File

@ -1,5 +1,4 @@
USING: kernel ; USING: kernel system ;
IN: calendar.backend IN: calendar.backend
SYMBOL: calendar-backend HOOK: gmt-offset os ( -- hours minutes seconds )
HOOK: gmt-offset calendar-backend ( -- hours minutes seconds )

View File

@ -1,17 +1,12 @@
USING: alien alien.c-types arrays calendar.backend USING: alien alien.c-types arrays calendar.backend
kernel structs math unix.time namespaces ; kernel structs math unix.time namespaces system ;
IN: calendar.unix IN: calendar.unix
TUPLE: unix-calendar ;
T{ unix-calendar } calendar-backend set-global
: get-time ( -- alien ) : get-time ( -- alien )
f time <uint> localtime ; f time <uint> localtime ;
: timezone-name ( -- string ) : timezone-name ( -- string )
get-time tm-zone ; get-time tm-zone ;
M: unix-calendar gmt-offset ( -- hours minutes seconds ) M: unix gmt-offset ( -- hours minutes seconds )
get-time tm-gmtoff 3600 /mod 60 /mod ; get-time tm-gmtoff 3600 /mod 60 /mod ;

View File

@ -1,12 +1,8 @@
USING: calendar.backend namespaces alien.c-types USING: calendar.backend namespaces alien.c-types system
windows windows.kernel32 kernel math combinators ; windows windows.kernel32 kernel math combinators ;
IN: calendar.windows IN: calendar.windows
TUPLE: windows-calendar ; M: windows gmt-offset ( -- hours minutes seconds )
T{ windows-calendar } calendar-backend set-global
M: windows-calendar gmt-offset ( -- hours minutes seconds )
"TIME_ZONE_INFORMATION" <c-object> "TIME_ZONE_INFORMATION" <c-object>
dup GetTimeZoneInformation { dup GetTimeZoneInformation {
{ [ dup TIME_ZONE_ID_INVALID = ] [ win32-error-string throw ] } { [ dup TIME_ZONE_ID_INVALID = ] [ win32-error-string throw ] }