risingwave_common::cast

Function i64_to_timestamptz

source
pub fn i64_to_timestamptz(t: i64) -> Result<Timestamptz, String>
Expand description

Converts UNIX epoch time to timestamptz.

The input UNIX epoch time is interpreted as follows:

  • [0, 1e11) are assumed to be in seconds.
  • [1e11, 1e14) are assumed to be in milliseconds.
  • [1e14, 1e17) are assumed to be in microseconds.
  • [1e17, upper) are assumed to be in nanoseconds.

This would cause no problem for timestamp in [1973-03-03 09:46:40, 5138-11-16 09:46:40).