mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-03 12:44:27 +02:00
Work around {} bug for older compilers
This commit is contained in:
22
date.h
22
date.h
@@ -4608,7 +4608,7 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
|||||||
{
|
{
|
||||||
auto ld = floor<days>(tp);
|
auto ld = floor<days>(tp);
|
||||||
auto y = year_month_day{ld + days{3}}.year();
|
auto y = year_month_day{ld + days{3}}.year();
|
||||||
auto start = local_days{(y - years{1})/date::dec/thu[last]} + (mon-thu);
|
auto start = local_days((y - years{1})/date::dec/thu[last]) + (mon-thu);
|
||||||
if (ld < start)
|
if (ld < start)
|
||||||
--y;
|
--y;
|
||||||
if (*fmt == CharT{'G'})
|
if (*fmt == CharT{'G'})
|
||||||
@@ -4639,7 +4639,7 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
|||||||
{
|
{
|
||||||
auto ld = floor<days>(tp);
|
auto ld = floor<days>(tp);
|
||||||
auto y = year_month_day{ld}.year();
|
auto y = year_month_day{ld}.year();
|
||||||
auto doy = ld - local_days{y/jan/1} + days{1};
|
auto doy = ld - local_days(y/jan/1) + days{1};
|
||||||
detail::save_stream<CharT, Traits> _(os);
|
detail::save_stream<CharT, Traits> _(os);
|
||||||
os.fill('0');
|
os.fill('0');
|
||||||
os.flags(std::ios::dec | std::ios::right);
|
os.flags(std::ios::dec | std::ios::right);
|
||||||
@@ -4739,7 +4739,7 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
|||||||
}
|
}
|
||||||
else if (modified == CharT{})
|
else if (modified == CharT{})
|
||||||
{
|
{
|
||||||
auto st = local_days{sun[1]/jan/ymd.year()};
|
auto st = local_days(sun[1]/jan/ymd.year());
|
||||||
if (ld < st)
|
if (ld < st)
|
||||||
os << CharT{'0'} << CharT{'0'};
|
os << CharT{'0'} << CharT{'0'};
|
||||||
else
|
else
|
||||||
@@ -4777,11 +4777,11 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
|||||||
else if (modified == CharT{})
|
else if (modified == CharT{})
|
||||||
{
|
{
|
||||||
auto y = year_month_day{ld + days{3}}.year();
|
auto y = year_month_day{ld + days{3}}.year();
|
||||||
auto st = local_days{(y - years{1})/12/thu[last]} + (mon-thu);
|
auto st = local_days((y - years{1})/12/thu[last]) + (mon-thu);
|
||||||
if (ld < st)
|
if (ld < st)
|
||||||
{
|
{
|
||||||
--y;
|
--y;
|
||||||
st = local_days{(y - years{1})/12/thu[last]} + (mon-thu);
|
st = local_days((y - years{1})/12/thu[last]) + (mon-thu);
|
||||||
}
|
}
|
||||||
auto wn = duration_cast<weeks>(ld - st).count() + 1;
|
auto wn = duration_cast<weeks>(ld - st).count() + 1;
|
||||||
if (wn < 10)
|
if (wn < 10)
|
||||||
@@ -4839,7 +4839,7 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
|||||||
}
|
}
|
||||||
else if (modified == CharT{})
|
else if (modified == CharT{})
|
||||||
{
|
{
|
||||||
auto st = local_days{mon[1]/jan/ymd.year()};
|
auto st = local_days(mon[1]/jan/ymd.year());
|
||||||
if (ld < st)
|
if (ld < st)
|
||||||
os << CharT{'0'} << CharT{'0'};
|
os << CharT{'0'} << CharT{'0'};
|
||||||
else
|
else
|
||||||
@@ -6482,7 +6482,7 @@ parse(std::basic_istream<CharT, Traits>& is,
|
|||||||
{
|
{
|
||||||
if (V == not_a_week_num || wd == not_a_weekday)
|
if (V == not_a_week_num || wd == not_a_weekday)
|
||||||
goto broken;
|
goto broken;
|
||||||
auto ymd = year_month_day{local_days{year{G-1}/dec/thu[last]} +
|
auto ymd = year_month_day{local_days(year{G-1}/dec/thu[last]) +
|
||||||
(mon-thu) + weeks{V-1} +
|
(mon-thu) + weeks{V-1} +
|
||||||
(weekday{static_cast<unsigned>(wd)}-mon)};
|
(weekday{static_cast<unsigned>(wd)}-mon)};
|
||||||
if (Y == not_a_year)
|
if (Y == not_a_year)
|
||||||
@@ -6505,7 +6505,7 @@ parse(std::basic_istream<CharT, Traits>& is,
|
|||||||
goto broken;
|
goto broken;
|
||||||
if (j != 0)
|
if (j != 0)
|
||||||
{
|
{
|
||||||
auto ymd = year_month_day{local_days{year{Y}/1/1} + days{j-1}};
|
auto ymd = year_month_day{local_days(year{Y}/1/1) + days{j-1}};
|
||||||
if (m == 0)
|
if (m == 0)
|
||||||
m = static_cast<int>(static_cast<unsigned>(ymd.month()));
|
m = static_cast<int>(static_cast<unsigned>(ymd.month()));
|
||||||
else if (month(m) != ymd.month())
|
else if (month(m) != ymd.month())
|
||||||
@@ -6523,7 +6523,7 @@ parse(std::basic_istream<CharT, Traits>& is,
|
|||||||
if (U == 0)
|
if (U == 0)
|
||||||
sd = year{Y-1}/dec/weekday{static_cast<unsigned>(wd)}[last];
|
sd = year{Y-1}/dec/weekday{static_cast<unsigned>(wd)}[last];
|
||||||
else
|
else
|
||||||
sd = sys_days{year{Y}/jan/sun[1]} + weeks{U-1} +
|
sd = sys_days(year{Y}/jan/sun[1]) + weeks{U-1} +
|
||||||
(weekday{static_cast<unsigned>(wd)} - sun);
|
(weekday{static_cast<unsigned>(wd)} - sun);
|
||||||
year_month_day ymd = sd;
|
year_month_day ymd = sd;
|
||||||
if (year{Y} != ymd.year())
|
if (year{Y} != ymd.year())
|
||||||
@@ -6545,7 +6545,7 @@ parse(std::basic_istream<CharT, Traits>& is,
|
|||||||
if (W == 0)
|
if (W == 0)
|
||||||
sd = year{Y-1}/dec/weekday{static_cast<unsigned>(wd)}[last];
|
sd = year{Y-1}/dec/weekday{static_cast<unsigned>(wd)}[last];
|
||||||
else
|
else
|
||||||
sd = sys_days{year{Y}/jan/mon[1]} + weeks{W-1} +
|
sd = sys_days(year{Y}/jan/mon[1]) + weeks{W-1} +
|
||||||
(weekday{static_cast<unsigned>(wd)} - mon);
|
(weekday{static_cast<unsigned>(wd)} - mon);
|
||||||
year_month_day ymd = sd;
|
year_month_day ymd = sd;
|
||||||
if (year{Y} != ymd.year())
|
if (year{Y} != ymd.year())
|
||||||
@@ -6564,7 +6564,7 @@ parse(std::basic_istream<CharT, Traits>& is,
|
|||||||
auto ymd = year{Y}/m/d;
|
auto ymd = year{Y}/m/d;
|
||||||
if (!ymd.ok())
|
if (!ymd.ok())
|
||||||
goto broken;
|
goto broken;
|
||||||
auto ld = local_days{ymd};
|
auto ld = local_days(ymd);
|
||||||
if (wd != not_a_weekday &&
|
if (wd != not_a_weekday &&
|
||||||
weekday{static_cast<unsigned>(wd)} != weekday{ld})
|
weekday{static_cast<unsigned>(wd)} != weekday{ld})
|
||||||
goto broken;
|
goto broken;
|
||||||
|
2
tz.cpp
2
tz.cpp
@@ -997,7 +997,7 @@ detail::MonthDayTime::canonicalize(date::year y)
|
|||||||
return;
|
return;
|
||||||
case month_last_dow:
|
case month_last_dow:
|
||||||
{
|
{
|
||||||
auto const ymd = year_month_day(sys_days{y/u.month_weekday_last_});
|
auto const ymd = year_month_day(sys_days(y/u.month_weekday_last_));
|
||||||
u.month_day_ = ymd.month()/ymd.day();
|
u.month_day_ = ymd.month()/ymd.day();
|
||||||
type_ = month_day;
|
type_ = month_day;
|
||||||
return;
|
return;
|
||||||
|
16
tz.h
16
tz.h
@@ -1162,7 +1162,7 @@ to_utc_time(const tai_time<Duration>& t) NOEXCEPT
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
return utc_time<duration>{t.time_since_epoch()} -
|
return utc_time<duration>{t.time_since_epoch()} -
|
||||||
(sys_days{year{1970}/jan/1} - sys_days{year{1958}/jan/1} + seconds{10});
|
(sys_days(year{1970}/jan/1) - sys_days(year{1958}/jan/1) + seconds{10});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Duration>
|
template <class Duration>
|
||||||
@@ -1173,7 +1173,7 @@ to_tai_time(const utc_time<Duration>& t) NOEXCEPT
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
return tai_time<duration>{t.time_since_epoch()} +
|
return tai_time<duration>{t.time_since_epoch()} +
|
||||||
(sys_days{year{1970}/jan/1} - sys_days{year{1958}/jan/1} + seconds{10});
|
(sys_days(year{1970}/jan/1) - sys_days(year{1958}/jan/1) + seconds{10});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Duration>
|
template <class Duration>
|
||||||
@@ -1199,7 +1199,7 @@ operator<<(std::basic_ostream<CharT, Traits>& os, const tai_time<Duration>& t)
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
auto tp = sys_time<duration>{t.time_since_epoch()} -
|
auto tp = sys_time<duration>{t.time_since_epoch()} -
|
||||||
(sys_days{year{1970}/jan/1} - sys_days{year{1958}/jan/1});
|
(sys_days(year{1970}/jan/1) - sys_days(year{1958}/jan/1));
|
||||||
return os << tp;
|
return os << tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1230,7 +1230,7 @@ to_utc_time(const gps_time<Duration>& t) NOEXCEPT
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
return utc_time<duration>{t.time_since_epoch()} +
|
return utc_time<duration>{t.time_since_epoch()} +
|
||||||
(sys_days{year{1980}/jan/sun[1]} - sys_days{year{1970}/jan/1} + seconds{9});
|
(sys_days(year{1980}/jan/sun[1]) - sys_days(year{1970}/jan/1) + seconds{9});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Duration>
|
template <class Duration>
|
||||||
@@ -1241,7 +1241,7 @@ to_gps_time(const utc_time<Duration>& t)
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
return gps_time<duration>{t.time_since_epoch()} -
|
return gps_time<duration>{t.time_since_epoch()} -
|
||||||
(sys_days{year{1980}/jan/sun[1]} - sys_days{year{1970}/jan/1} + seconds{9});
|
(sys_days(year{1980}/jan/sun[1]) - sys_days(year{1970}/jan/1) + seconds{9});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Duration>
|
template <class Duration>
|
||||||
@@ -1267,7 +1267,7 @@ operator<<(std::basic_ostream<CharT, Traits>& os, const gps_time<Duration>& t)
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
auto tp = sys_time<duration>{t.time_since_epoch()} +
|
auto tp = sys_time<duration>{t.time_since_epoch()} +
|
||||||
(sys_days{year{1980}/jan/sun[1]} - sys_days{year{1970}/jan/1});
|
(sys_days(year{1980}/jan/sun[1]) - sys_days(year{1970}/jan/1));
|
||||||
return os << tp;
|
return os << tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,7 +1295,7 @@ to_tai_time(const gps_time<Duration>& t) NOEXCEPT
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
return tai_time<duration>{t.time_since_epoch()} +
|
return tai_time<duration>{t.time_since_epoch()} +
|
||||||
(sys_days{year{1980}/jan/sun[1]} - sys_days{year{1958}/jan/1} + seconds{19});
|
(sys_days(year{1980}/jan/sun[1]) - sys_days(year{1958}/jan/1) + seconds{19});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Duration>
|
template <class Duration>
|
||||||
@@ -1306,7 +1306,7 @@ to_gps_time(const tai_time<Duration>& t) NOEXCEPT
|
|||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using duration = typename std::common_type<Duration, seconds>::type;
|
using duration = typename std::common_type<Duration, seconds>::type;
|
||||||
return gps_time<duration>{t.time_since_epoch()} -
|
return gps_time<duration>{t.time_since_epoch()} -
|
||||||
(sys_days{year{1980}/jan/sun[1]} - sys_days{year{1958}/jan/1} + seconds{19});
|
(sys_days(year{1980}/jan/sun[1]) - sys_days(year{1958}/jan/1) + seconds{19});
|
||||||
}
|
}
|
||||||
|
|
||||||
// format
|
// format
|
||||||
|
Reference in New Issue
Block a user