change contract on second' of
date' to allow only 1 leap second
This commit is contained in:
parent
22e067c7a9
commit
4323096a46
|
@ -38,7 +38,7 @@ The resulting @racket[date*] reflects the time according to the local
|
|||
time zone if @racket[local-time?] is @racket[#t], otherwise it
|
||||
reflects a date in UTC.}
|
||||
|
||||
@defstruct[date ([second (integer-in 0 61)]
|
||||
@defstruct[date ([second (integer-in 0 60)]
|
||||
[minute (integer-in 0 59)]
|
||||
[hour (integer-in 0 23)]
|
||||
[day (integer-in 1 31)]
|
||||
|
@ -50,10 +50,9 @@ reflects a date in UTC.}
|
|||
[time-zone-offset exact-integer?])
|
||||
#:inspector #f]{
|
||||
|
||||
Represents a date. For the @racket[second] field, values of
|
||||
@racket[60] and @racket[61] are for unusual, but possible for
|
||||
leap-seconds. The @racket[year-day] field reaches @racket[365] only in
|
||||
leap years.
|
||||
Represents a date. The @racket[second] field reaches @racket[60] only
|
||||
for leap seconds. The @racket[year-day] field reaches @racket[365]
|
||||
only in leap years.
|
||||
|
||||
The @racket[dst?] field is @racket[#t] if the date reflects a
|
||||
daylight-saving adjustment. The @racket[time-zone-offset] field
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
(require mzlib/date)
|
||||
|
||||
(test #t date? (date* 0 0 0 1 1 -3000 0 0 #f -1000 0 "AST"))
|
||||
(test #t date? (date* 60 59 23 31 12 3000 6 365 #t 1000 999999999 "ZST"))
|
||||
|
||||
(define (test-find s m h d mo y)
|
||||
(for ([local-time? (in-list '(#f #t))])
|
||||
(let* ([secs (find-seconds s m h d mo y local-time?)]
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
Version 5.3.0.11
|
||||
Changed contract on date second field to disallow 61, since
|
||||
leap seconds never appear more than once per minute
|
||||
racket/base: added impersonate-prompt-tag & chaperone-prompt-tag
|
||||
racket/control: added call/prompt, call/comp, abort/cc and
|
||||
allow #:tag argument for % and f-control
|
||||
|
|
|
@ -5032,8 +5032,8 @@ static Scheme_Object *check_date_fields(int argc, Scheme_Object **argv)
|
|||
Scheme_Object *a, *args[10];
|
||||
|
||||
a = argv[0];
|
||||
if (!SCHEME_INTP(a) || (SCHEME_INT_VAL(a) < 0) || (SCHEME_INT_VAL(a) > 61))
|
||||
scheme_wrong_field_contract(argv[10], "(integer-in 0 61)", a);
|
||||
if (!SCHEME_INTP(a) || (SCHEME_INT_VAL(a) < 0) || (SCHEME_INT_VAL(a) > 60))
|
||||
scheme_wrong_field_contract(argv[10], "(integer-in 0 60)", a);
|
||||
a = argv[1];
|
||||
if (!SCHEME_INTP(a) || (SCHEME_INT_VAL(a) < 0) || (SCHEME_INT_VAL(a) > 59))
|
||||
scheme_wrong_field_contract(argv[10], "(integer-in 0 59)", a);
|
||||
|
|
Loading…
Reference in New Issue
Block a user