apa512 / clj-rethinkdb

Eclipse Public License 1.0
205 stars 42 forks source link

Persist milliseconds of DateTimes #170

Closed lenworthrose closed 8 years ago

lenworthrose commented 8 years ago

clj-time's to-epoch function returns the number of seconds since epoch, which truncates the milliseconds of DateTime. Use to-long, which returns milliseconds since epoch, and divide by 1000 in order to properly format this number

apa512 commented 8 years ago

Thanks.

lenworthrose commented 8 years ago

@apa512 I noticed you closed the PR - do you have plans to fix this in another manner? It's causing issues in our software, since we need to retain millisecond precision

danielcompton commented 8 years ago

@lenworthrose could you add some tests for this new behaviour? Reopening as it looks like a valuable change.

apa512 commented 8 years ago

@lenworthrose I meant to merge but forgot to click the button. Sorry about that.

lenworthrose commented 8 years ago

@danielcompton Done! Created a unit test that writes a DateTime to the DB, then retrieves that value from the DB and compares the two. When I reverted my initial commit, this test failed.

@apa512 No worries! Just wanted to make sure this didn't get lost :smiley:

apa512 commented 8 years ago

Very good. I'll get this released right away.

Samstiles commented 8 years ago

Thanks @lenworthrose and @apa512 :)