windows.time: faster windows-time>timestamp.
parent
936bcc48e4
commit
80a7329de8
|
@ -5,7 +5,7 @@ classes.struct kernel math system unix unix.time unix.types ;
|
||||||
IN: calendar.unix
|
IN: calendar.unix
|
||||||
|
|
||||||
: timeval>seconds ( timeval -- seconds )
|
: timeval>seconds ( timeval -- seconds )
|
||||||
[ sec>> ] [ usec>> 1000000 / ] bi + ; inline
|
[ sec>> ] [ usec>> 1,000,000 / ] bi + ; inline
|
||||||
|
|
||||||
: timeval>duration ( timeval -- duration )
|
: timeval>duration ( timeval -- duration )
|
||||||
timeval>seconds seconds ;
|
timeval>seconds seconds ;
|
||||||
|
@ -14,7 +14,7 @@ IN: calendar.unix
|
||||||
[ unix-1970 ] dip timeval>seconds +second ;
|
[ unix-1970 ] dip timeval>seconds +second ;
|
||||||
|
|
||||||
: timespec>seconds ( timespec -- seconds )
|
: timespec>seconds ( timespec -- seconds )
|
||||||
[ sec>> ] [ nsec>> 1000000000 / ] bi + ; inline
|
[ sec>> ] [ nsec>> 1,000,000,000 / ] bi + ; inline
|
||||||
|
|
||||||
: timespec>duration ( timespec -- duration )
|
: timespec>duration ( timespec -- duration )
|
||||||
timespec>seconds seconds ;
|
timespec>seconds seconds ;
|
||||||
|
|
|
@ -14,7 +14,7 @@ IN: windows.time
|
||||||
[ dwLowDateTime>> ] [ dwHighDateTime>> ] bi >64bit ;
|
[ dwLowDateTime>> ] [ dwHighDateTime>> ] bi >64bit ;
|
||||||
|
|
||||||
: windows-time>timestamp ( n -- timestamp )
|
: windows-time>timestamp ( n -- timestamp )
|
||||||
10000000 /i seconds windows-1601 swap time+ ;
|
[ windows-1601 ] dip 10,000,000 /i +second ;
|
||||||
|
|
||||||
: windows-time ( -- n )
|
: windows-time ( -- n )
|
||||||
FILETIME <struct> [ GetSystemTimeAsFileTime ] keep
|
FILETIME <struct> [ GetSystemTimeAsFileTime ] keep
|
||||||
|
@ -22,7 +22,7 @@ IN: windows.time
|
||||||
|
|
||||||
: timestamp>windows-time ( timestamp -- n )
|
: timestamp>windows-time ( timestamp -- n )
|
||||||
#! 64bit number representing # of nanoseconds since Jan 1, 1601 (UTC)
|
#! 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 )
|
: windows-time>FILETIME ( n -- FILETIME )
|
||||||
[ FILETIME <struct> ] dip
|
[ FILETIME <struct> ] dip
|
||||||
|
|
Loading…
Reference in New Issue