]> gitweb.factorcode.org Git - factor.git/commitdiff
remove system-micros word from factor src tree
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 22 Jun 2010 06:49:11 +0000 (01:49 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 22 Jun 2010 06:49:11 +0000 (01:49 -0500)
basis/calendar/unix/unix.factor
basis/core-foundation/run-loop/run-loop.factor
basis/stack-checker/known-words/known-words.factor
core/system/system-docs.factor

index 40475b4d407ef53cbbc3da1d0f9b617de9926001..a1e83cc1c15e6d270f10a71df6c684a9ef9f37df 100644 (file)
@@ -29,6 +29,12 @@ IN: calendar.unix
 M: unix gmt-offset ( -- hours minutes seconds )
     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
-    timeval <struct> f [ gettimeofday io-error ] 2keep drop
-    timeval>unix-time ;
+    current-timeval timeval>unix-time ;
index 793efefbe869b81e663fa2514d737af9a039ed30..5396b83dcadeb4a65037176604a9c161af9b1ea3 100644 (file)
@@ -1,10 +1,12 @@
 ! Copyright (C) 2008, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types alien.syntax kernel math
-namespaces sequences destructors combinators threads heaps
-deques calendar system core-foundation core-foundation.strings
-core-foundation.file-descriptors core-foundation.timers
-core-foundation.time ;
+USING: accessors alien alien.c-types alien.syntax calendar
+classes.struct combinators core-foundation
+core-foundation.file-descriptors core-foundation.strings
+core-foundation.time core-foundation.timers deques destructors
+heaps kernel math namespaces sequences system threads unix
+unix.time ;
+FROM: calendar.unix => system-micros ;
 IN: core-foundation.run-loop
 
 CONSTANT: kCFRunLoopRunFinished 1
index a652c500bac5ff180c03e3d415900abba46f61fd..0721e61a2a9babefd4b483eb5df32802494a5c0d 100644 (file)
@@ -459,7 +459,6 @@ M: bad-executable summary
 \ special-object { fixnum } { object } define-primitive \ special-object make-flushable
 \ string-nth-fast { fixnum string } { fixnum } define-primitive \ string-nth-fast make-flushable
 \ strip-stack-traces { } { } define-primitive
-\ system-micros { } { integer } define-primitive \ system-micros make-flushable
 \ tag { object } { fixnum } define-primitive \ tag make-foldable
 \ unimplemented { } { } define-primitive
 \ word-code { word } { integer integer } define-primitive \ word-code make-flushable
index 8ef3b3e42a4b5b9960ba27869705e39b4bbd3379..b14cb90a6807202f1efc7bac19c3d3d53ae94196 100644 (file)
@@ -14,10 +14,6 @@ ARTICLE: "system" "System interface"
     vm
     image
 }
-"Getting the current time:"
-{ $subsections
-    system-micros
-}
 "Getting a monotonically increasing nanosecond count:"
 { $subsections nano-count }
 "Exiting the Factor VM:"
@@ -78,15 +74,10 @@ HELP: exit ( n -- )
 { $values { "n" "an integer exit code" } }
 { $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 )
 { $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." }
-{ $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
 { $values { "path" "a pathname string" } }