Fix bug in sys_time and local_time from_stream

* to handle microfortnights
This commit is contained in:
Howard Hinnant 2017-08-12 13:56:17 -04:00
parent 922abf1299
commit 82de27d339

4
date.h
View File

@ -6562,7 +6562,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
if (!fds.ymd.ok() || !fds.tod.in_conventional_range())
is.setstate(ios::failbit);
if (!is.fail())
tp = sys_days(fds.ymd) + duration_cast<Duration>(fds.tod.to_duration() - *offptr);
tp = round<Duration>(sys_days(fds.ymd) + fds.tod.to_duration() - *offptr);
return is;
}
@ -6580,7 +6580,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
if (!fds.ymd.ok() || !fds.tod.in_conventional_range())
is.setstate(ios::failbit);
if (!is.fail())
tp = local_days(fds.ymd) + duration_cast<Duration>(fds.tod.to_duration());
tp = round<Duration>(local_days(fds.ymd) + fds.tod.to_duration());
return is;
}