Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::chrono::nanoseconds for Timer construction #24

Merged
merged 1 commit into from
Aug 1, 2019
Merged

Conversation

barbu110
Copy link
Owner

@barbu110 barbu110 commented Aug 1, 2019

The constructor of Timer now takes std::chrono::nanoseconds as parameter.

This choice instead of the more general std::chrono::duration<Rep, Period> comes from the fac the nanosecond is the smallest unit supported by the timespec structure.

A timer can now be constructed as follows:

/* using duration specializations */
set_timeout(std::chrono::seconds{2}, /* ... */);

/* or using literals */
using namespace std::literals::chrono_literals;
set_interval(2s, /* ... */);

This pull request fixes #16.

@barbu110 barbu110 requested a review from slak44 August 1, 2019 16:08
@barbu110 barbu110 merged commit 94273b7 into master Aug 1, 2019
@barbu110 barbu110 deleted the issue-16 branch August 1, 2019 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use std::chrono::duration for timer utility
1 participant