remove system-micros word from factor src tree
parent
3b11e2d6aa
commit
0edadff45f
|
@ -29,6 +29,12 @@ IN: calendar.unix
|
||||||
M: unix gmt-offset ( -- hours minutes seconds )
|
M: unix gmt-offset ( -- hours minutes seconds )
|
||||||
get-time gmtoff>> 3600 /mod 60 /mod ;
|
get-time gmtoff>> 3600 /mod 60 /mod ;
|
||||||
|
|
||||||
|
: current-timeval ( -- timeval )
|
||||||
|
timeval <struct> f [ gettimeofday io-error ] 2keep drop ;
|
||||||
|
|
||||||
|
: system-micros ( -- n )
|
||||||
|
current-timeval
|
||||||
|
[ sec>> 1,000,000 * ] [ usec>> ] bi + ;
|
||||||
|
|
||||||
M: unix gmt
|
M: unix gmt
|
||||||
timeval <struct> f [ gettimeofday io-error ] 2keep drop
|
current-timeval timeval>unix-time ;
|
||||||
timeval>unix-time ;
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov
|
! Copyright (C) 2008, 2010 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types alien.syntax kernel math
|
USING: accessors alien alien.c-types alien.syntax calendar
|
||||||
namespaces sequences destructors combinators threads heaps
|
classes.struct combinators core-foundation
|
||||||
deques calendar system core-foundation core-foundation.strings
|
core-foundation.file-descriptors core-foundation.strings
|
||||||
core-foundation.file-descriptors core-foundation.timers
|
core-foundation.time core-foundation.timers deques destructors
|
||||||
core-foundation.time ;
|
heaps kernel math namespaces sequences system threads unix
|
||||||
|
unix.time ;
|
||||||
|
FROM: calendar.unix => system-micros ;
|
||||||
IN: core-foundation.run-loop
|
IN: core-foundation.run-loop
|
||||||
|
|
||||||
CONSTANT: kCFRunLoopRunFinished 1
|
CONSTANT: kCFRunLoopRunFinished 1
|
||||||
|
|
|
@ -459,7 +459,6 @@ M: bad-executable summary
|
||||||
\ special-object { fixnum } { object } define-primitive \ special-object make-flushable
|
\ special-object { fixnum } { object } define-primitive \ special-object make-flushable
|
||||||
\ string-nth-fast { fixnum string } { fixnum } define-primitive \ string-nth-fast make-flushable
|
\ string-nth-fast { fixnum string } { fixnum } define-primitive \ string-nth-fast make-flushable
|
||||||
\ strip-stack-traces { } { } define-primitive
|
\ strip-stack-traces { } { } define-primitive
|
||||||
\ system-micros { } { integer } define-primitive \ system-micros make-flushable
|
|
||||||
\ tag { object } { fixnum } define-primitive \ tag make-foldable
|
\ tag { object } { fixnum } define-primitive \ tag make-foldable
|
||||||
\ unimplemented { } { } define-primitive
|
\ unimplemented { } { } define-primitive
|
||||||
\ word-code { word } { integer integer } define-primitive \ word-code make-flushable
|
\ word-code { word } { integer integer } define-primitive \ word-code make-flushable
|
||||||
|
|
|
@ -14,10 +14,6 @@ ARTICLE: "system" "System interface"
|
||||||
vm
|
vm
|
||||||
image
|
image
|
||||||
}
|
}
|
||||||
"Getting the current time:"
|
|
||||||
{ $subsections
|
|
||||||
system-micros
|
|
||||||
}
|
|
||||||
"Getting a monotonically increasing nanosecond count:"
|
"Getting a monotonically increasing nanosecond count:"
|
||||||
{ $subsections nano-count }
|
{ $subsections nano-count }
|
||||||
"Exiting the Factor VM:"
|
"Exiting the Factor VM:"
|
||||||
|
@ -78,15 +74,10 @@ HELP: exit ( n -- )
|
||||||
{ $values { "n" "an integer exit code" } }
|
{ $values { "n" "an integer exit code" } }
|
||||||
{ $description "Exits the Factor process." } ;
|
{ $description "Exits the Factor process." } ;
|
||||||
|
|
||||||
HELP: system-micros ( -- us )
|
|
||||||
{ $values { "us" integer } }
|
|
||||||
{ $description "Outputs the number of microseconds elapsed since midnight January 1, 1970." }
|
|
||||||
{ $notes "This is a low-level word. The " { $vocab-link "calendar" } " vocabulary provides features for date/time arithmetic and formatting. For timing code, use " { $link nano-count } "." } ;
|
|
||||||
|
|
||||||
HELP: nano-count ( -- ns )
|
HELP: nano-count ( -- ns )
|
||||||
{ $values { "ns" integer } }
|
{ $values { "ns" integer } }
|
||||||
{ $description "Outputs a monotonically increasing count of nanoseconds elapsed since an arbitrary starting time. The difference of two calls to this word allows timing. This word is unaffected by system clock changes." }
|
{ $description "Outputs a monotonically increasing count of nanoseconds elapsed since an arbitrary starting time. The difference of two calls to this word allows timing. This word is unaffected by system clock changes." }
|
||||||
{ $notes "This is a low-level word. The " { $vocab-link "tools.time" } " vocabulary defines words to time code execution time. For system time, use " { $link system-micros } "." } ;
|
{ $notes "This is a low-level word. The " { $vocab-link "tools.time" } " vocabulary defines words to time code execution time." } ;
|
||||||
|
|
||||||
HELP: image
|
HELP: image
|
||||||
{ $values { "path" "a pathname string" } }
|
{ $values { "path" "a pathname string" } }
|
||||||
|
|
Loading…
Reference in New Issue