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

How do I know if getServerTime() succeeded? #1

Open
brianjmurrell opened this issue Jan 29, 2018 · 2 comments
Open

How do I know if getServerTime() succeeded? #1

brianjmurrell opened this issue Jan 29, 2018 · 2 comments

Comments

@brianjmurrell
Copy link

It's entirely possible that getServerTime() could fail in which case I'd want to keep calling it until it succeeds or some timeout is reached.

But there is no way for me to know if it was successful since it's private and I only get access to it indirectly through getUnixTime() which is skewed by millis().

So ultimately, I have no way of knowing if I can rely on what getUnixTime() is telling me other than to use some "less than some smallish-value" type heuristics.

I think the library either needs a flag to indicate that the time is accurate (i.e. there was a successful NTP transaction) or getUnixTime() should return 0 until the time is accurate the way getServerTime() does.

@iCounterBOX
Copy link

Hi .. good question..i want to use this lib...but sure need to know if time is acurate. this dateTime will be the timeStamp for the data in the cloud - would be great to get some feedback or info on this thx in advance

@sgenov
Copy link

sgenov commented Jan 30, 2020

As far as I can see the code right now (and I've tested it in my project), getUnixTime() returns <= 0 when there was an issue with getting the time from the server.
This should be enough for a check if we got the real time

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

3 participants