Skip to content

Compatibility to c++14 std::chrono_literals

Compare
Choose a tag to compare
@luni64 luni64 released this 14 Oct 17:40
· 72 commits to master since this release

This is just a small update to be compatible to the std::chrono::duration and the corresponding nice user defined literals. I.e. instead of passing in microseconds to begin() and trigger(), you can now also use std::chrono::durations.
Here some examples:

 timer[0].trigger(10ms);                                  // 10 ms
 timer[1].trigger(0.5s + 10ms);                           // 510 ms
 timer[2].trigger(2.5 * 0.3s + 20000us / 2);              // 760 ms
 timer[3].trigger(milliseconds(50) + microseconds(5000)); // 55ms

which makes a much nicer interface.