Skip to main content
Question

Internal format for TimeTZ

  • August 15, 2023
  • 2 replies
  • 6 views

Sergey_Cherepan_1
Forum|alt.badge.img+2

Hi,

I have to handle TimeTZ in UDx c++. Normally I do not allow TimeTZ in tables, but user managed to create new table with TimeTZ datatype and it was too late when I caught it.

After few experiments, I found that TimeTZ in Vertica has number of micros since UTC midnight in top 5 bytes of 8-byte value.

Out of curiosity, what lower 3 bytes of TimeTZ contains? Looking at Postgress code, it should be number of seconds since epoch, but PgSQL TimeTZ is 12 bytes vs Vertica 8 bytes.

Looks like Vertica original developers invented something new for content of lower 3 bytes in TimeTZ.

Would you mind to ask around and share?

Thanks in advance
Sergey

2 replies

SergeB
Forum|alt.badge.img
  • Participating Frequently
  • August 15, 2023

I think the lower 24 bits represent the timezone as UTC offset in seconds.


Sergey_Cherepan_1
Forum|alt.badge.img+2
  • Author
  • Participating Frequently
  • August 16, 2023

Thanks! That makes sense.