I ran across this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
std::tm
to_tm(zoned_seconds tp)
{
using namespace std;
using namespace std::chrono;
auto lt = tp.get_local_time();
auto ld = floor<days>(lt);
time_of_day<seconds> tod{ lt - ld }; // HERE!!!
year_month_day ymd{ ld };
tm t{};
t.tm_sec = tod.seconds().count();
t.tm_min = tod.minutes().count();
t.tm_hour = tod.hours().count();
t.tm_mday = (ymd.day() - 0d).count();
t.tm_mon = (ymd.month() - January).count();
t.tm_year = (ymd.year() - 1900y).count();
t.tm_wday = (weekday{ ld } - Sunday).count();
t.tm_yday = (ld - local_days{ ymd.year() / January / 1 }).count();
t.tm_isdst = tp.get_info().save != minutes{ 0 };
return t;
}
| |
Where can I find time_of_day<T>?
I found this at:
https://github.com/howardhinnant/date/wiki/Examples-and-Recipes#deltatz
Last edited on