Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/Log-advanced/Log-advanced.ino
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ void printTimestamp(Print* _logOutput) {
const unsigned long SECS_PER_DAY = 86400;

// Total time
const unsigned long msecs = millis() ;
const unsigned long msecs = millis();
const unsigned long secs = msecs / MSECS_PER_SEC;

// Time in components
const unsigned long MiliSeconds = msecs % MSECS_PER_SEC;
const unsigned long MilliSeconds = msecs % MSECS_PER_SEC;
const unsigned long Seconds = secs % SECS_PER_MIN ;
const unsigned long Minutes = (secs / SECS_PER_MIN) % SECS_PER_MIN;
const unsigned long Hours = (secs % SECS_PER_DAY) / SECS_PER_HOUR;

// Time as string
char timestamp[20];
sprintf(timestamp, "%02d:%02d:%02d.%03d ", Hours, Minutes, Seconds, MiliSeconds);
sprintf(timestamp, "%02d:%02d:%02d.%03d ", Hours, Minutes, Seconds, MilliSeconds);
_logOutput->print(timestamp);
}

Expand Down