简体   繁体   中英

High precision timestamp in SOCI library when working with PostgreSQL

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM