-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
Crating a Poco::Timestamp from Poco::DateTime and using Poco::DateTimeFormatter::format() creates invalid ISODate with negative hour, minute and second values for timestamps before October 15, 1582.
To Reproduce
std::string orig("1582-10-14T00:00:01Z");
Poco::DateTime dateTime;
int tzd;
Poco::DateTimeParser::tryParse(Poco::DateTimeFormat::ISO8601_FRAC_FORMAT, orig, dateTime, tzd);
const auto pts = dateTime.timestamp();
auto fmt = Poco::DateTimeFormatter::format(pts, Poco::DateTimeFormat::ISO8601_FRAC_FORMAT);
Expected behavior
Expected result is "1582-10-14T00:00:01.000000Z" instead of "1582-10-14T-23:-59:-59.000000Z" which is invalid ISODate.
Logs
If applicable, add logs to help explain your problem.
Screenshots
If applicable, add screenshots to help explain your problem.
Please add relevant environment information:
- OS Ubuntu 20.04
- POCO 1.10.1
Additional context
I'm not sure if this is a bug or limitation of allowed Poco::Timestamp date range. Interesting is that the year, month and date are properly formatted from Poco::Timestamp value and just the hour, minute and second become negative.