Timestamp

<< Click to Display Table of Contents >>

Navigation:  Glossary >

Timestamp

Previous pageReturn to chapter overviewNext page

TIMESTAMP is a scalar [data type] that stores a date and time. Per the SQL standard, a timestamp value has no time zone associated with it. For example, the value TIMESTAMP '2001-01-01 00:00:00' represents the start of the millennium, but interpretation is left to the system architect.

SQLstream's time semantics, and in particular the TIMESTAMP values held in the ROWTIME column and passed as rowtime bounds, are consistent with the SQL standard.

Time data accessed via JDBC are accessed as Java timestamp values and follow Java data semantics. A Java java.sql.Timestamp object represents a particular moment in time. It contains a long (64 bit signed integer) field that represents the number of milliseconds since January 1st, 1970 UTC. (For example, on any particular day, 6:00AM PST and 9:00AM EST are the same moment, and both correspond to the same java.sql.Timestamp.)

There is a tension between these notions of time, which system architects generally resolve by standardizing on UTC (Coordinated Universal Time) as the timezone for the SQLstream system. JDBC clients can remain in their local timezone. If you read/write data using the JDBC setTimestamp(Timestamp) and getTimestamp() methods, timestamp values will automatically be converted (by the java runtime library) to UTC timestamp values. An alternative design is for the JDBC client to locate itself in the UTC zone; in this case the java library does no conversion (see TimeZone for more details).

Note: The SQLstream s-Server's timezone is always UTC. The time functions return time in UTC, including the SQLstream operator CURRENT_ROW_TIMESTAMP for query results (an extension).