1 USING: calendar namespaces alien.c-types system
2 windows.kernel32 kernel math combinators windows.errors
3 accessors classes.struct calendar.format math.functions ;
6 : timestamp>SYSTEMTIME ( timestamp -- SYSTEMTIME )
17 [ - 1000 * >integer ] 2bi
19 } cleave \ SYSTEMTIME <struct-boa> ;
21 : SYSTEMTIME>timestamp ( SYSTEMTIME -- timestamp )
28 [ [ wSecond>> ] [ wMilliseconds>> 1000 / ] bi + ]
29 } cleave instant <timestamp> ;
31 M: windows gmt-offset ( -- hours minutes seconds )
32 TIME_ZONE_INFORMATION <struct>
33 dup GetTimeZoneInformation {
34 { TIME_ZONE_ID_INVALID [ win32-error-string throw ] }
35 { TIME_ZONE_ID_UNKNOWN [ Bias>> ] }
36 { TIME_ZONE_ID_STANDARD [ Bias>> ] }
37 { TIME_ZONE_ID_DAYLIGHT [ [ Bias>> ] [ DaylightBias>> ] bi + ] }
38 } case neg 60 /mod 0 ;
41 SYSTEMTIME <struct> [ GetSystemTime ] keep SYSTEMTIME>timestamp ;