| 93 | } |
| 94 | |
| 95 | static inline std::string date_to_string(std::int32_t jd) { |
| 96 | // For date conversion see |
| 97 | // https://doxygen.postgresql.org/backend_2utils_2adt_2datetime_8c.html#a889d375aaf2a25be071d818565142b9e |
| 98 | const std::int32_t POSTGRESQL_EPOCH_DATE = 2451545; |
| 99 | std::int32_t year, month, day; |
| 100 | date_to_ymd(POSTGRESQL_EPOCH_DATE + jd, year, month, day); |
| 101 | std::stringstream oss; |
| 102 | oss << year << '-' << std::setfill('0') << std::setw(2) << month << '-' |
| 103 | << std::setw(2) << day; |
| 104 | return oss.str(); |
| 105 | } |
| 106 | |
| 107 | static inline std::string timestamp_to_string(std::int64_t tstamp) { |
| 108 | // For timestamp conversion see |
no test coverage detected