]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix windows-time>FILETIME (why was this broken for so long?)
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 15 Dec 2008 09:47:13 +0000 (03:47 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 15 Dec 2008 09:47:13 +0000 (03:47 -0600)
basis/windows/time/time.factor

index 54a7a8e32a82bf221df54997b746569c8ec092c6..e63834d3695801278f3a78f6234cf6ec564c59ab 100644 (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 ;