forked from PaulStoffregen/Time
Added two comments to explain the while-loop in now()
This commit is contained in:
4
Time.cpp
4
Time.cpp
@ -248,7 +248,9 @@ time_t sysUnsyncedTime = 0; // the time sysTime unadjusted by sync
|
|||||||
|
|
||||||
|
|
||||||
time_t now() {
|
time_t now() {
|
||||||
while (millis() - prevMillis >= 1000){
|
// calculate number of seconds passed since last call to now()
|
||||||
|
while (millis() - prevMillis >= 1000) {
|
||||||
|
// millis() and prevMillis are both unsigned ints thus the subtraction will always be the absolute value of the difference
|
||||||
sysTime++;
|
sysTime++;
|
||||||
prevMillis += 1000;
|
prevMillis += 1000;
|
||||||
#ifdef TIME_DRIFT_INFO
|
#ifdef TIME_DRIFT_INFO
|
||||||
|
Reference in New Issue
Block a user