9.4. CURRENT_TIME
Available inDSQL, PSQL, ESQL
Syntax
CURRENT_TIME [ (<precision>) ]
<precision> ::= 0 | 1 | 2 | 3
The optional precision argument is not supported in ESQL.
CURRENT_TIME Parameter| Parameter | Description |
|---|---|
precision | Precision. The default value is 0. Not supported in ESQL |
TypeTIME
DescriptionCURRENT_TIME returns the current server time.
In versions prior to 2.0, the fractional part used to be always
, giving an effective precision of 0 decimals.
From Firebird 2.0 onward you can specify a precision when polling this variable.
The default is still 0 decimals, i.e. seconds precision..0000
Examples
select current_time from rdb$database
-- returns e.g. 14:20:19.6170
select current_time(2) from rdb$database
-- returns e.g. 14:20:23.1200
CURRENT_TIMEhas a default precision of 0 decimals, where Section 9.5, “CURRENT_TIMESTAMP” has a default precision of 3 decimals. As a result,CURRENT_TIMESTAMPis not the exact sum of Section 9.2, “CURRENT_DATE” andCURRENT_TIME, unless you explicitly specify a precision (i.e.CURRENT_TIME(3)orCURRENT_TIMESTAMP(0)).Within a PSQL module (procedure, trigger or executable block), the value of
CURRENT_TIMEwill remain constant every time it is read. If multiple modules call or trigger each other, the value will remain constant throughout the duration of the outermost module. If you need a progressing value in PSQL (e.g. to measure time intervals), use Section 9.14, “'NOW'”.
CURRENT_TIME and Firebird 4 time zone supportFirebird 4 will support time zones.
As part of this support, there will be an incompatibility with the CURRENT_TIME expression.
In Firebird 4, CURRENT_TIME will return the new TIME WITH TIME ZONE type.
For your queries to be compatible with database code of future Firebird versions, Firebird 2.5.9 introduced the Section 9.11, “LOCALTIME” expression.
In Firebird 2.5 and Firebird 3, LOCALTIME is a synonym for CURRENT_TIME.
In Firebird 4, LOCALTIME will continue to work as it does now (returning TIME [WITHOUT TIME ZONE]), while CURRENT_TIME will return a different data type, TIME WITH TIME ZONE.
Unless you need to be able to downgrade your database to Firebird 2.5.8 or earlier, we recommend to start using LOCALTIME instead of CURRENT_TIME.