os-time.scm 925 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Michael Zabka
  3. (import-lambda-definition-2 current-utc-time () "s48_get_current_time")
  4. (import-lambda-definition-2 timezone-offset () "s48_get_timezone")
  5. (define-record-type time :time
  6. (make-time seconds microseconds)
  7. time?
  8. (seconds time-seconds)
  9. (microseconds time-microseconds))
  10. (define-exported-binding "os-time-type" :time)
  11. (define (time=? time1 time2)
  12. (and
  13. (= (time-seconds time1)
  14. (time-seconds time2))
  15. (= (time-microseconds time1)
  16. (time-microseconds time2))))
  17. (define (time<? time1 time2)
  18. (if (< (time-seconds time1)
  19. (time-seconds time2))
  20. (< (time-microseconds time1)
  21. (time-microseconds time2))))
  22. (define (time<=? time1 time2)
  23. (not (time<? time2 time1)))
  24. (define (time>? time1 time2)
  25. (time<? time2 time1))
  26. (define (time>=? time1 time2)
  27. (not (time<? time1 time2)))