Search in sources :

Example 11 with TimestampData

use of org.hsqldb_voltpatches.types.TimestampData in project voltdb by VoltDB.

the class Session method getCurrentTimestamp.

/**
     * Returns the current timestamp, unchanged for the duration of the current
     * execution unit (statement)
     */
synchronized TimestampData getCurrentTimestamp(boolean withZone) {
    resetCurrentTimestamp();
    if (withZone) {
        if (currentTimestamp == null) {
            int nanos = (int) (currentMillis % 1000) * 1000000;
            currentTimestamp = new TimestampData((currentMillis / 1000), nanos, timeZoneSeconds);
        }
        return currentTimestamp;
    } else {
        if (localTimestamp == null) {
            int nanos = (int) (currentMillis % 1000) * 1000000;
            localTimestamp = new TimestampData(currentMillis / 1000 + timeZoneSeconds, nanos, 0);
        }
        return localTimestamp;
    }
}
Also used : TimestampData(org.hsqldb_voltpatches.types.TimestampData)

Aggregations

TimestampData (org.hsqldb_voltpatches.types.TimestampData)11 Date (java.sql.Date)2 Timestamp (java.sql.Timestamp)2 TimeData (org.hsqldb_voltpatches.types.TimeData)2 Type (org.hsqldb_voltpatches.types.Type)2 BigDecimal (java.math.BigDecimal)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Constraint (org.hsqldb_voltpatches.Constraint)1 HSQLParseException (org.hsqldb_voltpatches.HSQLInterface.HSQLParseException)1 HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)1 SchemaObject (org.hsqldb_voltpatches.SchemaObject)1 Session (org.hsqldb_voltpatches.Session)1 Table (org.hsqldb_voltpatches.Table)1 TextTable (org.hsqldb_voltpatches.TextTable)1 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)1 BinaryData (org.hsqldb_voltpatches.types.BinaryData)1 ClobData (org.hsqldb_voltpatches.types.ClobData)1 DateTimeType (org.hsqldb_voltpatches.types.DateTimeType)1 IntervalSecondData (org.hsqldb_voltpatches.types.IntervalSecondData)1