Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmyatt committed Feb 28, 2018
1 parent da9a397 commit 33e5a20
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <WProgram.h>
#endif

#define TIMELIB_ENABLE_MILLIS
#include "TimeLib.h"

static tmElements_t tm; // a cache of time elements
Expand Down Expand Up @@ -253,6 +254,11 @@ time_t sysUnsyncedTime = 0; // the time sysTime unadjusted by sync
#endif


time_t now() {
uint32_t sysTimeMillis;
return now(sysTimeMillis);
}

time_t now(uint32_t& sysTimeMillis) {
// calculate number of seconds passed since last call to now()
while ((sysTimeMillis = millis() - prevMillis) >= 1000) {
Expand All @@ -279,11 +285,6 @@ time_t now(uint32_t& sysTimeMillis) {
return (time_t)sysTime;
}

time_t now() {
uint32_t sysTimeMillis;
return now(sysTimeMillis);
}

void setTime(time_t t) {
#ifdef TIME_DRIFT_INFO
if(sysUnsyncedTime == 0)
Expand Down

0 comments on commit 33e5a20

Please sign in to comment.