Namespaces
Variants
Actions

Talk:c/chrono/clock

From cppreference.com
< Talk:c‎ | chrono

Hi,

I'd like to add something like:

On posix the time often elapses with cpu usage and slows down on cpu sleep. On Windows the time is usually close to the wall time.

I guess it could help understanding the uncertainties. Unfortunatelly I have no good source for this claim.

[edit] Engineering units of time

In the example we see the nanoseconds being multiplied by 10^-6, i.e., one millionth. But to normalize the nanoseconds count to seconds, shouldn't we multiply by 10^-9, i.e., one billionth?

Correct, but the example is normalising to milliseconds --Ybab321 (talk) 06:13, 28 February 2022 (PST)

[edit] Example provided does not compile due to missing "threads.h"

The example provided on the page uses "threads.h" which produces a compilation error with either of the compilers available. If this is the intended behaviour I recommend to add a note to mention and explain this to the reader. When trying this example in a different editor (such as https://www.w3schools.com/cpp/trycpp.asp?filename=demo_helloworld), the example compiles without errors. Dfch (talk) 00:09, 10 August 2023 (PDT)

Made it compile. Honestly, I don't know why coliru's not building this code, it might be a temporary issue or they're providing a locked down pthread(?) --Ybab321 (talk) 02:53, 10 August 2023 (PDT)
That is weird. Now (a few days later) it does compile for me as well (with GCC 5/13, but not when using clang). So, it seems to be sth related to coliru's setup/site. Sorry for the bother. Dfch (talk) 00:05, 13 August 2023 (PDT)