| 1 |
#!r6rs |
| 2 |
;; Copyright 2010 Derick Eddington. My MIT-style license is in the file named |
| 3 |
;; LICENSE from the original collection this file is distributed with. |
| 4 |
|
| 5 |
(library (srfi :19 time compat) |
| 6 |
(export |
| 7 |
time-resolution |
| 8 |
timezone-offset |
| 9 |
current-time |
| 10 |
cumulative-thread-time |
| 11 |
cumulative-process-time |
| 12 |
cumulative-gc-time |
| 13 |
time-nanosecond |
| 14 |
time-second) |
| 15 |
(import |
| 16 |
(rnrs base) |
| 17 |
(only (core) microsecond microsecond->utc) |
| 18 |
(srfi :19 time not-implemented)) |
| 19 |
|
| 20 |
(define time-resolution 1000) |
| 21 |
|
| 22 |
(define timezone-offset |
| 23 |
(let ((t (microsecond))) |
| 24 |
(/ (- t (microsecond->utc t)) #e1e6))) |
| 25 |
|
| 26 |
(define (current-time) |
| 27 |
(let-values (((d m) (div-and-mod (microsecond) #e1e6))) |
| 28 |
(cons d (* m 1000)))) |
| 29 |
|
| 30 |
(define time-nanosecond cdr) |
| 31 |
(define time-second car) |
| 32 |
) |