Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What the value of "chrono::steady_clock::now().time_since_epoch().count()" represents?

cout << chrono::steady_clock::now().time_since_epoch().count() << "\n"; // it prints a 14-digit value

Is is the number of nanoseconds passed since 1970?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is is the number of nanoseconds passed since 1970?

No.

It is the number of some duration unit passed since some time.

This may not sound useful, and a single reading of std::chrono::stead_clock arguably isn’t very useful. (Beyond, say, seeding a random number generator perhaps)

steady_clock readings are intended to be compared against other steady_clock readings. It is useful for measuring elapsed time.

The count() is only useful if you cast the duration to a known duration period.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading