now() cannot be converted to sys_days!

Having trouble with:


1
2
auto n = std::chrono::system_clock::now();
std::chrono::sys_days sd = n;



Why ? n is a time_point and sd is also time_point (actually time_point<system_clock, days>)??

Hi,

I found this example:

https://en.cppreference.com/w/cpp/chrono/year_month_day/operator_days

The example uses now in the ctor of sys_days.

Just throwing out ideas here:

I am guessing that the 2 time points are not quite the same type - the sys_days is cast to a <day> type, whereas now is in a fraction of seconds ? I further guess that there are no implicit casts from any time_point to any other time_point - that would be a lot of combinations? But one can do it in the ctor as per the example above.
thanks!!
Topic archived. No new replies allowed.