Closed nicoruti closed 8 years ago
Hi Nico,
I had some reason to round Date instances (which foolishly I don't remember right now). I will have a look into that matter and either comment the reason in the code or remove the rounding.
best regards, Wolfgang
-----Original Message----- From: Nico Rutishauser notifications@github.com To: Wolfgang-Schuetzelhofer/jcypher jcypher@noreply.github.com Sent: Tue, Oct 20, 2015 2:09 pm Subject: [jcypher] Date rounded to 1s (#6)
In MappingUtil, I found the following code: public static long dateToLong(Date date) { long millis = date.getTime(); if (date instanceof java.sql.Date) return millis; else if (date instanceof Time) return millis; else if (date instanceof Timestamp) return millis; return (millis / 1000) * 1000; }
What's the reason that a java.util.Date instance rounded to 1000 millis? When storing java.util.Dates, they are not stored exactly. — Reply to this email directly or view it on GitHub.
Hi Nico,
I have removed the rounding of Date instances I had it due to an incorrect usage of Calendar in one of my unit test methods. That should not happen :( The next release, comming this month will contain the corrected mapping code.
best regards and thanks, Wolfgang
Hi Nico,
I have removed the rounding of Date instances I had it due to an incorrect usage of Calendar in one of my unit test methods. That should not happen :( The next release, comming this month will contain the corrected mapping code.
best regards and thanks, Wolfgang
-----Original Message----- From: Nico Rutishauser notifications@github.com To: Wolfgang-Schuetzelhofer/jcypher jcypher@noreply.github.com Sent: Tue, Oct 20, 2015 2:09 pm Subject: [jcypher] Date rounded to 1s (#6)
In MappingUtil, I found the following code: public static long dateToLong(Date date) { long millis = date.getTime(); if (date instanceof java.sql.Date) return millis; else if (date instanceof Time) return millis; else if (date instanceof Timestamp) return millis; return (millis / 1000) * 1000; }
What's the reason that a java.util.Date instance rounded to 1000 millis? When storing java.util.Dates, they are not stored exactly. — Reply to this email directly or view it on GitHub.
Thanks for the quick fix!
In MappingUtil, I found the following code:
What's the reason that a java.util.Date instance is rounded to 1000 millis? When storing
java.util.Date
objects, they are not stored exactly.