Data acquisition has become much faster and along with it, the necessity for higher time resolution. Due to popular request, we now introduce millisecond timestamp resolution for c-tree time types. This support is available across multiple c-tree APIs, including core c-tree support, c-treeDB and c-treeACE SQL. This support required addition of extended data types, which you should understand may impact backward compatibility with some applications.
This support includes the following changes:
CTTIME and CTTIMEMS are not comparable without transformation. CTTIME is a LONG value holding the number of seconds since midnight, CTTIMEMS is a LONG value holding the number of milliseconds since midnight.
Calling ctdbSetFieldAsTimeMsec against a CT_TIME field would cause a loss of milliseconds. If this attempted, the error CTDBRET_MSEC_NOTSUPPORTED (4147) is returned.
Searching an index based on CT_TIME is problematic when milliseconds are significant since the index information does not contain milliseconds and, as we do with filter, we cannot automatically add milliseconds before doing the search. SQL will error out when performing index searches on CT_TIME columns.
Note: This support requires new extended data types (New Extended Data Types Support, /doc/v11ace/68793.htm) in c-treeACE V11 forward.
Several functions were added to c-treeDB related to TIMESTAMP (CTDATETIME):
CTDATETIME <-> CTTIMEMS conversions:
ctdbDateTimeSetTimeMsec()
ctdbDateTimeGetTimeMsec()
Millisecond DateTime handling:
ctdbDateTimePackMsec()
ctdbDateTimeUnpackMsec()
Timestamps with milliseconds are supported on existing timestamp data with no conversion. A minor behavior change should be noted:
Prior to this release, a query similar to the example shown below would have ignored the milliseconds portion, returning records matching '11/11/2015 12:00:15.000':
SELECT * FROM mytable WHERE mytimestamp = '11/11/2015 12:00:15.998'
With the changes described above, the milliseconds are now significant.