using infinite loop with epoch chrono method to get timestamp, cpu heats up to 90 degrees

Mar 21, 2023 at 10:13pm
Code below:

auto miliseconds = duration_cast(system_clock::now().time_since_epoch()).count(); bool todayDayStamp = false;

miliseconds = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();

cout << miliseconds << endl;

is there any more convenient way to get timestamp with infinite loop? my computer smells like hot dog hair which scares me and I need to get the timestamp with infinite loop. Kindly advise
Mar 21, 2023 at 10:23pm
Let the CPU sleep for a while on each iteration.

https://en.cppreference.com/w/cpp/thread/sleep_for
Last edited on Mar 21, 2023 at 10:24pm
Topic archived. No new replies allowed.