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 M: windows gmt-offset ( -- hours minutes seconds )
7 TIME_ZONE_INFORMATION <struct>
8 dup GetTimeZoneInformation {
9 { TIME_ZONE_ID_INVALID [ win32-error-string throw ] }
10 { TIME_ZONE_ID_UNKNOWN [ Bias>> ] }
11 { TIME_ZONE_ID_STANDARD [ Bias>> ] }
12 { TIME_ZONE_ID_DAYLIGHT [ [ Bias>> ] [ DaylightBias>> ] bi + ] }
13 } case neg 60 /mod 0 ;
15 : timestamp>SYSTEMTIME ( timestamp -- SYSTEMTIME )
26 [ - 1000 * >integer ] 2bi
28 } cleave \ SYSTEMTIME <struct-boa> ;
30 : SYSTEMTIME>timestamp ( SYSTEMTIME -- timestamp )
37 [ [ wSecond>> ] [ wMilliseconds>> 1000 /f ] bi + ]
38 } cleave gmt-offset-duration <timestamp> ;