Roy Lyseng wrote:
Jay Pipes wrote:
Jim Starkey wrote:
Roland Bouman wrote:
Hi!
I'm sorry I can't comment on the inheritance issue. However, I would
like to throw in my 2 cts regarding the naming of the type.
This maybe a bikeshed thing, but I think it would be better to name
the type exactly after what it is capable of. I mean, HIRES probably
means "high resolution", but the problem with that type of naming
schemas is that they age. What is nowadays considered "high" may be
considered "medium" or "low" in the future.
So, I would rather suggest to go for TIMESTAMP_NS_PRECISION or
TIMESTAMP_NANOS or even TIMESTAMP_NANOSECOND_PREC or
TIMESTAMP_NANOSECOND_PRECISION because that clearly and unambiguously
(?) declares the scope of the type.
Hey, you guys work for Sun. Rather than TIMESTAMP_HIRES, shouldn't
it be TIMESTAMP_ONBOARDED?
Incidentally, whatever it's called, it works just fine. Interbase,
and later Firebird, have been using it since 1984. The Rdb products
uses a 64 bit representation of the number of "klunks" (100
microsecond unit, the precision of the VAX internal clock) since
November 17, 1858. I switched to discrete date (days since base
base) and time since midnight.
Cool. Here is the encoding scheme I came up with for DATETIME in 8
bytes:
/*
* This data type is packed as follows:
*
* bits:
*
* | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
* | YY | YY | YY | YY | YY | YY | YY | YY |
* | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
* | YY | YY | YY | YY | YY | YY | MM | MM |
* | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
* | MM | MM | DD | DD | DD | DD | DD | HH |
* | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
* | HH | HH | HH | HH | mm | mm | mm | mm |
* | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
* | mm | mm | SS | SS | SS | SS | SS | SS |
* | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
* | SS | uS | uS | uS | uS | uS | uS | uS |
* | 15 | 14 | 13 | 12 | 11 | 10 | 09 | 08 |
* | uS | uS | uS | uS | uS | uS | uS | uS |
* | 07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 |
* | uS | uS | uS | uS | uS | TT | TT | TT |
*
* Where:
*
* YY == Year (1 - 9999)
* MM == Month (1 - 12)
* DD == Days (1 - 31)
* HH == Hours (0 - 59)
* mm == Minutes (0 - 59)
* SS == Seconds (0 - 59)
* uS == Microseconds (0 - 1,000,000)
* TT == Type (1-4 currently, may change)
*/
This gives microsecond precision for any date in the range 1-9999 (SQL
standard I believe) in an 8-byte storage format.
Great!
You might change microseconds to 0 - 999999.
Yes, of course. Good catch.
And change seconds to 0 - 61, which will allow one or two leap seconds
(again according to the standard :)
Heh, yes, those pesky leap seconds. :) You're right. You can disregard
my previous comment about the timezones and second range...not sure what
I was thinking at the time. Has nothing to do with timezones, and
everything to do with leap years.
Cheers,
Jay
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp