Debian Codegraph @

%3a19/time/compat.larceny.sls

raw
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 (rename (my:timezone-offset 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 (primitives r5rs:require current-utc-time timezone-offset)
18 (srfi :19 time not-implemented))
19
20 (define dummy (begin (r5rs:require 'time) #F))
21
22 ;; Larceny uses gettimeofday() which gives microseconds,
23 ;; so our resolution is 1000 nanoseconds
24 (define time-resolution 1000)
25
26 (define my:timezone-offset
27 (let-values (((secs _) (current-utc-time)))
28 (timezone-offset secs)))
29
30 (define (current-time)
31 (let-values (((secs micros) (current-utc-time)))
32 (cons secs (* micros 1000))))
33
34 (define time-nanosecond cdr)
35 (define time-second car)
36 )