Christian Smith wrote:
John Stanton uttered:
The Sqlite date/time routimes have a resolution to seconds, not
milliseconds. If you want milliseconds from SQL implement your own
user defined functions which give you milliseconds. You would access
the time functions using the API of the underlying OS.
You might choose to implement your underlying storage as a 64 bit
integer.
If you use the julianday representation, the integer component is the
number of days since "noon in Greenwich on November 24, 4714 B.C", with
the fractional part being the fraction of that day. Hence, the
resolution is determined by the fractional component of the real number.
Now, in the UK, I get the following:
sqlite> select julianday('now');
2454295.1407767
The integer component consumes probably 21 bits of the available 52 bits
mantissa of an IEEE-754 64-bit real. That leaves 31 bits for the
fractions of a day, giving a resolution of 1/24855 of a second:
2^31/(60*60*24) = 24855.134814814814814814814814815
Plenty enough for milli-second resolution.
Probably not very good for embedded applications if an FPU is not
available.
Christian
Look in date.c to see how the Sqlite date functions use the FP number.
If you are using a recent Intel/AMD processor there is an instruction
which accesses a timeing register and gives very efficient, high
resolution sub-microsecond level timing provided you insert the
assembler instruction in your program.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------