From 82de27d33959f50de85bf12d9140473a9f8a45a8 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sat, 12 Aug 2017 13:56:17 -0400 Subject: [PATCH] Fix bug in sys_time and local_time from_stream * to handle microfortnights --- date.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/date.h b/date.h index f76005e..cc049ff 100644 --- a/date.h +++ b/date.h @@ -6562,7 +6562,7 @@ from_stream(std::basic_istream& 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(fds.tod.to_duration() - *offptr); + tp = round(sys_days(fds.ymd) + fds.tod.to_duration() - *offptr); return is; } @@ -6580,7 +6580,7 @@ from_stream(std::basic_istream& 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(fds.tod.to_duration()); + tp = round(local_days(fds.ymd) + fds.tod.to_duration()); return is; }