add time output to both clock sync and time <epoch> cli
This commit is contained in:
@@ -144,7 +144,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
uint32_t curr = getRTCClock()->getCurrentTime();
|
uint32_t curr = getRTCClock()->getCurrentTime();
|
||||||
if (sender_timestamp > curr) {
|
if (sender_timestamp > curr) {
|
||||||
getRTCClock()->setCurrentTime(sender_timestamp + 1);
|
getRTCClock()->setCurrentTime(sender_timestamp + 1);
|
||||||
strcpy(reply, "OK - clock set");
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
|
DateTime dt = DateTime(now);
|
||||||
|
sprintf(reply, "OK - clock set: %02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
|
||||||
} else {
|
} else {
|
||||||
strcpy(reply, "ERR: clock cannot go backwards");
|
strcpy(reply, "ERR: clock cannot go backwards");
|
||||||
}
|
}
|
||||||
@@ -161,7 +163,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
uint32_t curr = getRTCClock()->getCurrentTime();
|
uint32_t curr = getRTCClock()->getCurrentTime();
|
||||||
if (secs > curr) {
|
if (secs > curr) {
|
||||||
getRTCClock()->setCurrentTime(secs);
|
getRTCClock()->setCurrentTime(secs);
|
||||||
strcpy(reply, "(OK - clock set!)");
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
|
DateTime dt = DateTime(now);
|
||||||
|
sprintf(reply, "OK - clock set: %02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
|
||||||
} else {
|
} else {
|
||||||
strcpy(reply, "(ERR: clock cannot go backwards)");
|
strcpy(reply, "(ERR: clock cannot go backwards)");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user