Sean Lynch Sean Lynch - 1 year ago 138
C++ Question

std::chrono default duration for time_since_epoch

If I have the following clock and use it to get a count of ticks since the clock's epoch, what does this count actually represent.


For instance I just ran this and got
. What does this number mean? Is it nanoseconds, microseconds, etc?

Answer Source

The type of the duration is std::chrono::high_resolution_clock::duration. You can inspect a duration's tick period with: std::chrono::high_resolution_clock::duration::period::num and std::chrono::high_resolution_clock::duration::period::den. This is the numerator and denominator of a fraction representing the amount of seconds per tick (e.g. 1/1000000000 for nanoseconds).

The epoch is unspecified, but for you is 1389375799048790227 ticks from when you got that result.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download