Merge pull request #1638 from stepancheg/idris2-time

Use C idris2_time for all C-based backends
This commit is contained in:
Edwin Brady 2021-07-16 09:40:08 +01:00 committed by GitHub
commit 050abe663e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 8 deletions

View File

@ -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)

View File

@ -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))

View File

@ -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)))

View File

@ -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))