mardi 3 décembre 2019

Get seconds passed since time_point in chrono

What i want to do ?

Set the time_point to now intro p1 variable.

const auto p1 = std::chrono::system_clock::now();

Get the seconds passed since time_point was stored into p1 ?

auto time = std::chrono::duration_cast<std::chrono::seconds>(p1.time_since_epoch().count()

When i try to print time it returns something like this

15756345273

I want the output to do, 1/2/3/4/5 in seconds, or 1/2/3/4/5 hours.. How i can do that ? And why it's returns that weird number?

Aucun commentaire:

Enregistrer un commentaire