Re: Date-Only NSTimestamps
Re: Date-Only NSTimestamps
- Subject: Re: Date-Only NSTimestamps
- From: Chuck Hill <email@hidden>
- Date: Wed, 2 Jan 2008 20:05:20 -0800
On Jan 2, 2008, at 1:48 PM, Pierce T. Wetter III wrote:
On Jan 2, 2008, at 2:36 PM, Galen Rhodes wrote:
Hmmmmm. Well. No. I think you're assuming that the dates are
stored as floating point or double precision real values. Under
WO 5.x the NSTimestamp is descended from java.util.Date which
stores the time as a long integer representing the milliseconds
from the standard epoch. I believe GregorianCalendar does as
well. And I believe this is the same way that MySQL stores them too.
So, in that case, there is definitely a difference between
23:59:59.999 and 00:00:00.000. All comparisons (and math) are
done using the long millisecond value.
Oh, gag. That means subtle rounding errors with Oracle and
FrontBase when using dates. Oh joy. Because its quite possible to
get/store 23:59:59.9999 in the database. Does that mean Monday
becomes Tuesday?
FrontBase quietly truncates anything past the third digit in the
milliseconds. Not sure what Oracle does.
This is a potential problem depending on the database _if_ other non-
Java processes are writing to the database. As Java is limited to
999 milliseconds, WO processes should not cause such values.
Stupid Java architects.
It is generally a hard problem if you need to represent things at a
time granularity given the lack of industry standardization.
I still say that endOfDay() is still wrong, you shouldn't assume
what the internal format of the number is, and you shouldn't be
using <=, only <. It might work, but only because the Java
implementation is broken in a different way.
:-)
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden