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

Give access to _lastUpdate would let users deal with better accuracy requirements #23

Open
ybizeul opened this issue Jan 16, 2017 · 4 comments

Comments

@ybizeul
Copy link

ybizeul commented Jan 16, 2017

I'm working on an application that is time sensitive, at least in a relative way.
I don't need exact microsecond precision of the returned time, but I need a more or less reliable way to determine at the millisecond where I'm standing compared to the epoch.

Simply giving access to _lastUpdate does the job I think, as I can now get a string representing a ms epoch that way :

unsigned long seconds = timeClient.getEpochTime();
unsigned long ms = (millis() - timeClient.getLastUpdate()) % 1000;
char ms_char[12];
sprintf(ms_char,"%lu%03lu",seconds,ms);

Now I don't know what the best design is for this library :

  • Propose a getMillisecondString()
  • Simply let use deal with a public getLastUpdate() like I did
  • Deal with 64bit to return a ms epoch as a number...
@creeg2
Copy link

creeg2 commented Jul 20, 2017

I'd like to see a getEpochMillis() that just removes the "divide by 1000" from the current getEpochTime(). This would require support for the "unsigned long long" type.

unsigned long long getEpochMillis();

@blackketter
Copy link

My pull request #22 includes this, feel free to grab my branch or apply that patch.

@voanhcuoc
Copy link

If one is interested in milliseconds, most of the time he only cares about the interval between 2 periods. In that case, my fork may help. It helps you obtain milliseconds from getEpochTime() without a code change, but it's a compromise, so use it carefully.

@WhymustIhaveaname
Copy link

I completed the decimal part of NTP, removed the communication latency, and added a new function get_millis() to get the ms of this second (which is a float). You can see my fork or Pull Request #102.

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

No branches or pull requests

5 participants