Skip to content

Commit

Permalink
Fixed adjust-timestamp tests to work in the US
Browse files Browse the repository at this point in the history
  • Loading branch information
dlowe-net committed Oct 16, 2011
1 parent bbcf4e8 commit 996e4eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/local-time.lisp
Expand Up @@ -736,10 +736,12 @@ In other words:
(push `(%set-timestamp-part ,part ,value) functions))
((string= operation :offset)
(push `(%offset-timestamp-part ,part ,value) functions))
((or (string= operation :utc-offset)
(string= operation :timezone))
(push (second change) params)
(push operation params))
((string= operation :utc-offset)
(push part params)
(push :utc-offset params))
((string= operation :timezone)
(push part params)
(push :timezone params))
(t (error "Unexpected operation ~S" operation)))))
:finally
(loop
Expand Down
8 changes: 4 additions & 4 deletions test/simple.lisp
Expand Up @@ -98,20 +98,20 @@

(deftest test/adjust-timestamp/bug1 ()
(let* ((timestamp (parse-timestring "2006-01-01T00:00:00Z"))
(modified-timestamp (adjust-timestamp timestamp (offset :year 1))))
(modified-timestamp (adjust-timestamp timestamp (timezone +utc-zone+) (offset :year 1))))
(is (timestamp= (parse-timestring "2007-01-01T00:00:00Z") modified-timestamp))))

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

(deftest 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))))
(modified-timestamp (adjust-timestamp timestamp (timezone +utc-zone+) (offset :day-of-week :monday))))
(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))))
(modified-timestamp (adjust-timestamp timestamp (timezone +utc-zone+) (offset :day-of-week :monday))))
(is (timestamp= (parse-timestring "2009-03-02T01:00:00.000000+00:00") modified-timestamp))))

#+nil
Expand Down

0 comments on commit 996e4eb

Please sign in to comment.