-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add NTPServerSync before getNetworkTime #22
Conversation
Memory usage change @ cf8c0e3
Click for full report table
Click for full report CSV
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the return code of NTPServerSync
. -1 indicates an error. Maybe we can return UNIX time Time(1970,1,1,0,0,0,0)
in that case.
Memory usage change @ 5f9ad4c
Click for full report table
Click for full report CSV
|
src/ArduinoCellular.cpp
Outdated
float tz; | ||
modem.getNetworkTime(&year, &month, &day, &hour, &minute, &second, &tz); | ||
if (modem.NTPServerSync()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (modem.NTPServerSync()) { | |
if (modem.NTPServerSync() == 0) { |
I think a return code of 0 indicates success. @cristidragomir97 can you double check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, i was for sure wrong. I've changed it checking if != -1
to be on the safe side 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pennam I think that -1 is the generic error code while there are other +CNTP:
result codes that indicate an error. I'd check for == 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebromero Thanks! I was wrong again 🥲
Memory usage change @ b53f899
Click for full report table
Click for full report CSV
|
Memory usage change @ 94aeac0
Click for full report table
Click for full report CSV
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Calling
getNetworkTime
withoutNTPServerSync
returns some weird time values in the past1388591169 -> Wed Jan 01 2014 15:46:09 GMT+0000
Adding
NTPServerSync
call solves this issue