Skip to content

Commit

Permalink
[project @ fix test adjust-timestamp/bug2 (PLEASE AUDIT!)]
Browse files Browse the repository at this point in the history
  • Loading branch information
attila-lendvai committed Jan 25, 2010
1 parent 609a0e1 commit 890559a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/local-time.lisp
Expand Up @@ -857,7 +857,7 @@ the previous day given by OFFSET."

(safe-adjust (part offset time)
(with-decoded-timestamp (:nsec nsec :sec sec :minute minute :hour hour :day day
:month month :year year :timezone timezone)
:month month :year year :timezone timezone :offset utc-offset)
time
(multiple-value-bind (month-new year-new)
(%normalize-month-year-pair
Expand Down
9 changes: 6 additions & 3 deletions tests/tests.lisp
Expand Up @@ -306,17 +306,20 @@
(test adjust-timestamp/bug1
(let* ((timestamp (parse-timestring "2006-01-01T00:00:00Z"))
(modified-timestamp (adjust-timestamp timestamp (offset :year 1))))
(timestamp= (parse-timestring "2007-01-01T00:00:00Z") modified-timestamp)))
(is (timestamp= (parse-timestring "2007-01-01T00:00:00Z") modified-timestamp))))

(test adjust-timestamp/bug2
(let* ((timestamp (parse-timestring "2009-03-01T01:00:00.000000+00:00"))
(modified-timestamp (adjust-timestamp timestamp (offset :month 1))))
(timestamp= (parse-timestring "2009-04-01T01:00:00.000000+00:00") modified-timestamp)))
(is (timestamp= (parse-timestring "2009-04-01T01:00:00.000000+00:00") modified-timestamp))))

(test adjust-timestamp/bug3
(let* ((timestamp (parse-timestring "2009-03-01T01:00:00.000000+00:00"))
(modified-timestamp (adjust-timestamp timestamp (offset :day-of-week :monday))))
(timestamp= (parse-timestring "2009-02-23T01:00:00.000000+00:00") modified-timestamp)))
(is (timestamp= (parse-timestring "2009-02-23T01:00:00.000000+00:00") modified-timestamp)))
(let* ((timestamp (parse-timestring "2009-03-04T01:00:00.000000+00:00"))
(modified-timestamp (adjust-timestamp timestamp (offset :day-of-week :monday))))
(is (timestamp= (parse-timestring "2009-03-02T01:00:00.000000+00:00") modified-timestamp))))

#+nil
(test adjust-days
Expand Down

0 comments on commit 890559a

Please sign in to comment.