From: Chris Hanson Date: Fri, 31 Mar 2000 14:15:09 +0000 (+0000) Subject: Change date representation to have separate values for date and day. X-Git-Tag: 20090517-FFI~4133 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=792ac911434637e9d5e08159fdae7bdf457841f7;p=mit-scheme.git Change date representation to have separate values for date and day. --- diff --git a/v7/src/rcs/object.scm b/v7/src/rcs/object.scm index 2ff94d7bc..8468ecbec 100644 --- a/v7/src/rcs/object.scm +++ b/v7/src/rcs/object.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: object.scm,v 1.4 2000/03/20 22:52:51 cph Exp $ +$Id: object.scm,v 1.5 2000/03/31 14:15:09 cph Exp $ Copyright (c) 1988, 1991, 1999, 2000 Massachusetts Institute of Technology @@ -60,23 +60,25 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (unparser/standard-method 'rcsdelta (lambda (state delta) (unparse-string state (delta/number delta))))) - -(define *date-rounds-to-day?* #f) (define (date/make year month day hour minute second) (let ((year (if (< year 100) (+ 1900 year) year))) (let ((dt (make-decoded-time second minute hour day month year 0))) - (cons dt - (decoded-time->universal-time - (if *date-rounds-to-day?* - (make-decoded-time 0 0 0 day month year 0) - dt)))))) + (vector dt + (decoded-time->universal-time dt) + (decoded-time->universal-time + (make-decoded-time 0 0 0 day month year 0)))))) + +(define (date/decoded date) (vector-ref date 0)) +(define (date/universal date) (vector-ref date 1)) +(define (date/day date) (vector-ref date 2)) -(define-integrable (date/decoded date) (car date)) -(define-integrable (date/universal date) (cdr date)) +(define (date->string date) (decoded-time->string (date/decoded date))) -(define-integrable (date->string date) - (decoded-time->string (date/decoded date))) +(define (date? x y) (> (date/universal x) (date/universal y))) -(define-integrable (date? x y) (> (date/day x) (date/day y))) \ No newline at end of file