blob: 6bc783c4cd40240cdbeccb3c1638467cc719d2bb (
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");
timer::scoped_timer s{t};
usleep(100 * 1000);
}
kShowTime();
{
puts("Sleep 500ms");
timer::scoped_timer s{t};
usleep(500 * 1000);
}
kShowTime();
return 0;
}
|