Project

General

Profile

Actions

Bug #3915

closed

time::toIsoString and time::toString overflow with large dates

Added by Alex Afanasyev almost 8 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Utils
Target version:
Start date:
01/11/2017
Due date:
% Done:

100%

Estimated time:

Description

During conversion system_clock::TimePoint to boost::posix_time (for formatting purposes), there is a silent variable overflow when TimePoint is large. It doesn't even work 100 years from now:

Here is the test snippet

  system_clock::TimePoint value = fromUnixTimestamp(milliseconds(1390966967032LL));
  BOOST_CHECK_EQUAL(toIsoString(value), "20140129T034247.032000");

  value += days(365 * 100 + 25 - 1); // 36524 days
  BOOST_CHECK_EQUAL(toIsoString(value), "21140129T034247.032000");

Expected:

../tests/unit-tests/util/time.t.cpp:88: info: check toIsoString(value) == "20140129T034247.032000" has passed
../tests/unit-tests/util/time.t.cpp:91: info: check toIsoString(value) == "21140129T034247.032000" has passed

Actual:

../tests/unit-tests/util/time.t.cpp:88: info: check toIsoString(value) == "20140129T034247.032000" has passed
../tests/unit-tests/util/time.t.cpp:91: error: in "Util/TestTime/LargeDates": check toIsoString(value) == "21140129T034247.032000" has failed [19771222T211431.032000 != 21140129T034247.032000]

As a result of this, there is an issue with v2::KeyChain self-signing certificate generation: it's validity period was expected to be set to 1000 years from now(), but was set to a time point in the past.


Related issues 3 (0 open3 closed)

Related to ndn-cxx - Bug #4315: ndnsec cert-gen: not-before cannot be later than not-afterClosed09/30/2017

Actions
Related to ndn-cxx - Bug #4478: time::fromIsoString doesn't decode large datesClosedAlex Afanasyev01/25/2018

Actions
Related to ndn-cxx - Bug #5176: ValidityPeriod.NotAfter=99991231T235959 misinterpretedClosedJunxiao Shi

Actions
Actions

Also available in: Atom PDF