I have two std::chrono::time_point instances in variables exp
and time
. exp
has a time in the future and time
is the current time. But when I compare them as in this snippet:
std::time_t t_exp = std::chrono::system_clock::to_time_t(exp);
std::time_t t_time = std::chrono::system_clock::to_time_t(time);
std::cout << std::ctime(&t_exp) << std::ctime(&t_time) << (time > exp) << std::endl;
I get output:
Sat Apr 26 01:39:43 4758
Fri May 29 18:11:59 2020
1
Which is wrong because exp
is in the year 4758 and time
is in the year 2020.
Where am I going wrong?
Aucun commentaire:
Enregistrer un commentaire