Skip to content

Commit

Permalink
Fix inflation of timestamps to use round instead of floor.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Jun 9, 2017
1 parent 2ace5f3 commit 0e20e0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/dao/column.lisp
Expand Up @@ -63,7 +63,7 @@
(float
(multiple-value-bind (sec nsec)
(truncate value)
(local-time:universal-to-timestamp sec :nsec (* (floor (* nsec 1000000)) 1000))))
(local-time:universal-to-timestamp sec :nsec (* (round (* nsec 1000000)) 1000))))
(string
(local-time:parse-timestring value :date-time-separator #\Space))
(null nil)))
Expand Down
2 changes: 1 addition & 1 deletion t/dao.lisp
Expand Up @@ -252,7 +252,7 @@
(mito:create-dao 'user :registered-at now)
(let ((user (mito:find-dao 'user :id 1)))
(is-type (slot-value user 'registered-at) 'local-time:timestamp)
(ok (/= (local-time:nsec-of (slot-value user 'registered-at)) 0))))
(ok (/= 0 (local-time:nsec-of (slot-value user 'registered-at))))))
(disconnect-toplevel))

(finalize)

0 comments on commit 0e20e0f

Please sign in to comment.