Example Code on Github

The chrono namespace includes the following time-measurement objects.

  • Microseconds: 32-bit value for microseconds
  • ClockTime: 64-bit value for seconds and nanoseconds (clock as in CPU clock)
  • Time: 32-bit value in seconds (basically a time_t object)

The parent object for all chrono items is api::WorkObject or api::InfoObject. Both of the top level objects provide a way to insert a static delay.

#include <sapi/chrono.hpp>
wait(Seconds(1)); //wait for one second
wait(Milliseconds(1000)); //wait for one second
wait(Microseconds(1000000)); //wait for one second

ClockTime clock_time;
wait(clock_time); //wait based on a clock time value

Microseconds microseconds;
microseconds = Milliseconds(100);
wait(microseconds); //wait based on a microsecond value


void wait(

const chrono::Microseconds & microseconds

Delays based on a chrono::Microseconds value.



//Milliseconds, Seconds, and Nanoseconds will convert to Microseconds automatically
wait(Nanoseconds(999)); //this won't wait because it converts to 0 microseconds

This method will yield control of the processor to another thread. So the delay time may go over based on scheduling constraints.

typedef u32 micro_time_t

Defines the type for a chrono::MicroTime value.

typedef Microseconds MicroTime

typedef class Timer MicroTimer


Thanks for Coming!

Subscribe to news and updates