]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/windows/time/time.factor
Merge branch 'master' into redis
[factor.git] / basis / windows / time / time.factor
index 54a7a8e32a82bf221df54997b746569c8ec092c6..71726a554a8fadb123bc988239e2fbf275a4ca84 100644 (file)
@@ -1,18 +1,19 @@
 ! Copyright (C) 2007 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types kernel math windows windows.kernel32
-namespaces calendar math.bitwise ;
+USING: alien alien.c-types kernel math windows.errors
+windows.kernel32 namespaces calendar math.bitwise ;
 IN: windows.time
 
 : >64bit ( lo hi -- n )
-    32 shift bitor ;
+    32 shift bitor ; inline
 
 : windows-1601 ( -- timestamp )
     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 ;