From: John Benediktsson Date: Mon, 16 Jul 2012 22:30:58 +0000 (-0700) Subject: windows.time: faster windows-time>timestamp. X-Git-Tag: 0.97~2897 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=80a7329de82fb9f7edec55761249c9e836a33e1b windows.time: faster windows-time>timestamp. --- diff --git a/basis/calendar/unix/unix.factor b/basis/calendar/unix/unix.factor index f913ef0ee9..c02f836da8 100644 --- a/basis/calendar/unix/unix.factor +++ b/basis/calendar/unix/unix.factor @@ -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 ; diff --git a/basis/windows/time/time.factor b/basis/windows/time/time.factor index 913e613312..f0e3182449 100644 --- a/basis/windows/time/time.factor +++ b/basis/windows/time/time.factor @@ -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 [ 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 ] dip