Product Documentation

Automatic Data Aggregation

Previous Topic

Next Topic

Using Automatic Timestamps

The Automatic System Time feature provides automatic GMT system timestamps, which are useful for time series data, such as automatically tracking the time of each record insert or update.

Some data sources do not capture the timestamp of data they collect. To simplify using such data, the FairCom Database Engine allows such data to be timestamped automatically. The auto-generated timestamp can be used to automatically track the insert and update times of a record.

The FairCom Database Engine provides functions to create fields automatically set to the system timestamp on an insert or update or both. Each field must be the autosystemtime type. The timezone of the timestamp is always GMT, which makes it easy to compare data from locations in different timezones.

Auto-generated timestamps may be used as the primary key of a record, although they do not guarantee uniqueness (they may cause errors when used as primary keys). Most operating systems cannot provide a timestamp with a fine enough level of precision to ensure uniqueness when inserting more than approximately 500 records a second.

When you configure tables for Automatic Data Aggregation through the cttimestamp.json file, the "timestampField" attribute applied to a field automatically enables auto-timestamps for that field, and you are not required to use any of the alternative API functions described below. Refer to Using Automatic Data Aggregation in the Automatic Data Aggregation section for complete details.

For direct application development, automatic timestamp functions are provided in the c-treeDB, FairCom DB ISAM, and REST APIs.

GMT

Timestamps are stored in Greenwich Mean Time (GMT), not local server time. GMT is the default offset (i.e. an offset of 0 hours and 0 minutes) because it provides a universal anchor for all time zones. When viewing a timestamp, a customer can change a timezone offset to any valid value.

API Support

Automatic System Time assignment support has been added to the c-tree APIs.

The REST API provides a new property in the field information of the table object, autosystemtime. See Get Table Definition - GET.

c-treeDB provides two functions:

The FairCom DB ISAM API provides four functions to manage fields whose value is automatically set to the current system timestamp on an insert or an update:

In This Chapter

REST API autosystemtime for Automatic System Time

Hot Alter Table Support for Automatic System Timestamp

c-treeDB Support for Automatic System Time

FairCom DB ISAM Support for Automatic System Time

TOCIndex