Skip to content

Added micros64 and used to fix and improve gettimeofday. #3830

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

Merged
merged 1 commit into from
Nov 14, 2017

Conversation

BrandonLWhite
Copy link
Contributor

This resolves #3814 and adds a micros64() global function that is very useful.

There is certainly more that can be done to improve wallclock time-keeping, but this is a step in the right direction I feel. This allows my application to have a reasonably decent current timestamp.

This now works well enough for me, when it previously was wrong:

auto now_ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();

I purposely did not touch clock_gettime() or time() because I want to focus on achieving a functional gettimeofday first. If this PR is accepted, I'm willing to work on those functions too.

@igrr igrr merged commit 5b92569 into esp8266:master Nov 14, 2017
@BrandonLWhite
Copy link
Contributor Author

Thank you! I'm thrilled to have an accepted PR in your project!

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.

gettimeofday incorrect value for tv_usec
2 participants