9.4. CURRENT_TIME

Available in

DSQL, PSQL, ESQL

Syntax

  1. CURRENT_TIME [ (<precision>) ]
  2. <precision> ::= 0 | 1 | 2 | 3

The optional precision argument is not supported in ESQL.

Table 168. CURRENT_TIME Parameter
ParameterDescription

precision

Precision. The default value is 0. Not supported in ESQL

Type

TIME

Description

CURRENT_TIME returns the current server time. In versions prior to 2.0, the fractional part used to be always “.0000”, 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.

Examples

  1. select current_time from rdb$database
  2. -- returns e.g. 14:20:19.6170
  3. select current_time(2) from rdb$database
  4. -- returns e.g. 14:20:23.1200

Notes

  • Unlike CURRENT_TIME, the default precision of CURRENT_TIMESTAMP has changed to 3 decimals. As a result, CURRENT_TIMESTAMP is no longer the exact sum of CURRENT_DATE and CURRENT_TIME, unless you explicitly specify a precision.

  • Within a PSQL module (procedure, trigger or executable block), the value of CURRENT_TIME will 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 'NOW'.