]> gitweb.factorcode.org Git - factor.git/commitdiff
windows.time: faster windows-time>timestamp.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 16 Jul 2012 22:30:58 +0000 (15:30 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 16 Jul 2012 22:30:58 +0000 (15:30 -0700)
basis/calendar/unix/unix.factor
basis/windows/time/time.factor

index f913ef0ee9da158bc3f70392035e62cb6dfe2a03..c02f836da84ebbfd0378b39be4104532aa259a16 100644 (file)
@@ -5,7 +5,7 @@ classes.struct kernel math system unix unix.time unix.types ;
 IN: calendar.unix
 
 : timeval>seconds ( timeval -- seconds )
-    [ sec>> ] [ usec>> 1000000 / ] bi + ; inline
+    [ sec>> ] [ usec>> 1,000,000 / ] bi + ; inline
 
 : timeval>duration ( timeval -- duration )
     timeval>seconds seconds ;
@@ -14,7 +14,7 @@ IN: calendar.unix
     [ unix-1970 ] dip timeval>seconds +second ;
 
 : timespec>seconds ( timespec -- seconds )
-    [ sec>> ] [ nsec>> 1000000000 / ] bi + ; inline
+    [ sec>> ] [ nsec>> 1,000,000,000 / ] bi + ; inline
 
 : timespec>duration ( timespec -- duration )
     timespec>seconds seconds ;
index 913e613312ebd369adf405b4ffa911ca89d69e6a..f0e31824499b49c3f6dea7e8927b2da52b29821f 100644 (file)
@@ -14,7 +14,7 @@ IN: windows.time
     [ dwLowDateTime>> ] [ dwHighDateTime>> ] bi >64bit ;
 
 : windows-time>timestamp ( n -- timestamp )
-    10000000 /i seconds windows-1601 swap time+ ;
+    [ windows-1601 ] dip 10,000,000 /i +second ;
 
 : windows-time ( -- n )
     FILETIME <struct> [ GetSystemTimeAsFileTime ] keep
@@ -22,7 +22,7 @@ IN: windows.time
 
 : timestamp>windows-time ( timestamp -- n )
     #! 64bit number representing # of nanoseconds since Jan 1, 1601 (UTC)
-    >gmt windows-1601 (time-) 10000000 * >integer ;
+    >gmt windows-1601 (time-) 10,000,000 * >integer ;
 
 : windows-time>FILETIME ( n -- FILETIME )
     [ FILETIME <struct> ] dip