From d8e39b3e30203c9c103bbf3c746cf06459f8bc1e Mon Sep 17 00:00:00 2001 From: Sander Visser Date: Wed, 20 Apr 2022 11:52:04 +0200 Subject: [PATCH] Fix useless casts in date.h --- include/date/date.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/date/date.h b/include/date/date.h index 143bc9a4..f9c6ee08 100644 --- a/include/date/date.h +++ b/include/date/date.h @@ -5152,7 +5152,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, tm.tm_wday = static_cast(extract_weekday(os, fds)); if (os.fail()) return os; - tm.tm_yday = static_cast((ld - local_days(ymd.year()/1/1)).count()); + tm.tm_yday = (ld - local_days(ymd.year()/1/1)).count(); CharT f[3] = {'%'}; auto fe = std::begin(f) + 1; if (modified == CharT{'E'}) @@ -5781,7 +5781,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, tm.tm_wday = static_cast(extract_weekday(os, fds)); if (os.fail()) return os; - tm.tm_yday = static_cast((ld - local_days(ymd.year()/1/1)).count()); + tm.tm_yday = (ld - local_days(ymd.year()/1/1)).count(); facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f)); } #endif @@ -5829,7 +5829,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, tm.tm_wday = static_cast(extract_weekday(os, fds)); if (os.fail()) return os; - tm.tm_yday = static_cast((ld - local_days(ymd.year()/1/1)).count()); + tm.tm_yday = (ld - local_days(ymd.year()/1/1)).count(); facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f)); } #endif @@ -5906,7 +5906,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, tm.tm_wday = static_cast(extract_weekday(os, fds)); if (os.fail()) return os; - tm.tm_yday = static_cast((ld - local_days(ymd.year()/1/1)).count()); + tm.tm_yday = (ld - local_days(ymd.year()/1/1)).count(); facet.put(os, os, os.fill(), &tm, std::begin(f), std::end(f)); } #endif @@ -7783,8 +7783,8 @@ from_stream(std::basic_istream& is, const CharT* fmt, if (ymd.ok()) { if (wd == not_a_weekday) - wd = static_cast((weekday(sys_days(ymd)) - Sunday).count()); - else if (wd != static_cast((weekday(sys_days(ymd)) - Sunday).count())) + wd = (weekday(sys_days(ymd)) - Sunday).count(); + else if (wd != (weekday(sys_days(ymd)) - Sunday).count()) goto broken; if (!computed) {