Fix windows-time>FILETIME (why was this broken for so long?)

db4
Slava Pestov 2008-12-15 03:47:13 -06:00
parent 89255e08c1
commit b14c49f1a5
1 changed files with 6 additions and 5 deletions

View File

@ -11,8 +11,9 @@ IN: windows.time
1601 1 1 0 0 0 instant <timestamp> ;
: FILETIME>windows-time ( FILETIME -- n )
[ FILETIME-dwLowDateTime ] keep
FILETIME-dwHighDateTime >64bit ;
[ FILETIME-dwLowDateTime ]
[ FILETIME-dwHighDateTime ]
bi >64bit ;
: windows-time>timestamp ( n -- timestamp )
10000000 /i seconds windows-1601 swap time+ ;
@ -28,12 +29,12 @@ IN: windows.time
: windows-time>FILETIME ( n -- FILETIME )
"FILETIME" <c-object>
[
[ 32 bits set-FILETIME-dwLowDateTime ] 2keep
[ -32 shift ] dip set-FILETIME-dwHighDateTime
[ [ 32 bits ] dip set-FILETIME-dwLowDateTime ]
[ [ -32 shift ] dip set-FILETIME-dwHighDateTime ] 2bi
] keep ;
: timestamp>FILETIME ( timestamp -- FILETIME/f )
[ >gmt timestamp>windows-time windows-time>FILETIME ] [ f ] if* ;
dup [ >gmt timestamp>windows-time windows-time>FILETIME ] when ;
: FILETIME>timestamp ( FILETIME -- timestamp/f )
FILETIME>windows-time windows-time>timestamp ;