blob: 5ac169c6f9ea92955076c827d793e7fc54b31779 (
plain) (
tree)
|
|
#include <timer.h>
#include <unistd.h>
#include <cstdio>
int main() {
timer::timer t;
const auto kShowTime = [&t]() {
std::fprintf(stderr, "usec=%f msec=%f sec=%f\n", t.as_usec(), t.as_msec(),
t.as_sec());
};
{
puts("Sleep 100ms");
const timer::scoped_timer kS{t};
usleep(100 * 1000);
}
kShowTime();
{
puts("Sleep 500ms");
const timer::scoped_timer kS{t};
usleep(500 * 1000);
}
kShowTime();
return 0;
}
|