Product Documentation

c-treeACE V11.0 Update Guide

Previous Topic

Next Topic

Millisecond Timestamp Resolution Support

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:

  1. A new data type, CT_TIME_MS, was added to the core c-tree DODA to store time with millisecond support.
  2. A new base c-tree type, CTTIMEMS, was added to hold a time with millisecond format.

    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.

  3. New c-treeDB functions were added to set and get files as CTTIMEMS, specifically ctdbGetFieldAsTimeMsec and ctdbSetFieldAsTimeMsec.

    Calling ctdbSetFieldAsTimeMsec against a CT_TIME field would cause a loss of milliseconds. If this attempted, the error CTDBRET_MSEC_NOTSUPPORTED (4147) is returned.

  4. c-treeDB and c-treeACE SQL now support time and timestamp with millisecond precision on newly created tables.
  5. New functions were added to c-treeDB time with millisecond manipulation functions: ctdbTimePackMsec and ctdbTimeUnpackMsec.

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.

TOCIndex