File: os-time.scm

package info (click to toggle)
scheme48 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,232 kB
  • sloc: lisp: 88,907; ansic: 87,519; sh: 3,224; makefile: 771
file content (37 lines) | stat: -rw-r--r-- 925 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
; Part of Scheme 48 1.9.  See file COPYING for notices and license.

; Authors: Michael Zabka


(import-lambda-definition-2 current-utc-time () "s48_get_current_time")
(import-lambda-definition-2 timezone-offset () "s48_get_timezone")

(define-record-type time :time
  (make-time seconds microseconds)
  time?
  (seconds time-seconds)
  (microseconds time-microseconds))

(define-exported-binding "os-time-type" :time)

(define (time=? time1 time2)
  (and 
   (= (time-seconds time1)
      (time-seconds time2))
   (= (time-microseconds time1)
      (time-microseconds time2))))

(define (time<? time1 time2)
  (if (< (time-seconds time1)
         (time-seconds time2))
      (< (time-microseconds time1)
         (time-microseconds time2))))

(define (time<=? time1 time2)
  (not (time<? time2 time1)))
      
(define (time>? time1 time2)
  (time<? time2 time1))

(define (time>=? time1 time2)
  (not (time<? time1 time2)))