High precision timestamp in SOCI library when working with PostgreSQL

512 Views Asked by At

SOCI library describes binding for std::tm to work with timestamps. std::tm structure precision is second, but PostgreSQL timestamp provides better precision. Can you advise the optimal way to access timestamps with less than second precision?

I tried unsigned long and long long data types for accessing timestamps but without success. The only way I succeeded is string, but this will require parsing it (I would like to have some conventional value to work with - like, long in milliseconds or even better c++11 time_point), which is far from optimal.

Thanks in advance.

1

There are 1 best solutions below

0
On

If you're communicating with PostgreSQL via libpq, use libpqtypes. It'll help with managing PostgreSQL data types.

If you're not using libpq, details please.