mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-11 13:36:08 +03:00
Merge pull request #1638 from stepancheg/idris2-time
Use C idris2_time for all C-based backends
This commit is contained in:
commit
050abe663e
@ -107,10 +107,10 @@ export
|
||||
system : HasIO io => String -> io Int
|
||||
system cmd = primIO (prim__system cmd)
|
||||
|
||||
%foreign support "idris2_time"
|
||||
"scheme:blodwen-time"
|
||||
%foreign "C:idris2_time, libidris2_support, idris2_support.h"
|
||||
prim__time : PrimIO Int
|
||||
|
||||
||| Return the number of seconds since epoch.
|
||||
export
|
||||
time : HasIO io => io Integer
|
||||
time = pure $ cast !(primIO prim__time)
|
||||
|
@ -421,7 +421,6 @@
|
||||
(micro (mod s 1000000)))
|
||||
(sleep (make-time 'time-duration (* 1000 micro) sec))))
|
||||
|
||||
(define (blodwen-time) (time-second (current-time)))
|
||||
(define (blodwen-clock-time-utc) (current-time 'time-utc))
|
||||
(define (blodwen-clock-time-monotonic) (current-time 'time-monotonic))
|
||||
(define (blodwen-clock-time-duration) (current-time 'time-duration))
|
||||
|
@ -213,9 +213,6 @@
|
||||
(define blodwen-sleep thread-sleep!)
|
||||
(define (blodwen-usleep s) (thread-sleep! (/ s 1e6)))
|
||||
|
||||
(define (blodwen-time)
|
||||
(exact-floor (time->seconds (current-time))))
|
||||
|
||||
|
||||
(define (blodwen-arg-count)
|
||||
(length (command-line)))
|
||||
|
@ -432,8 +432,6 @@
|
||||
(define (blodwen-sleep s) (sleep s))
|
||||
(define (blodwen-usleep us) (sleep (* 0.000001 us)))
|
||||
|
||||
(define (blodwen-time) (current-seconds))
|
||||
|
||||
(define (blodwen-clock-time-utc) (current-time 'time-utc))
|
||||
(define (blodwen-clock-time-monotonic) (current-time 'time-monotonic))
|
||||
(define (blodwen-clock-time-duration) (current-time 'time-duration))
|
||||
|
Loading…
Reference in New Issue
Block a user