Skip to content

Commit f30698e

Browse files
committed
add time output to both clock sync and time <epoch> cli
1 parent eb58266 commit f30698e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/helpers/CommonCLI.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
144144
uint32_t curr = getRTCClock()->getCurrentTime();
145145
if (sender_timestamp > curr) {
146146
getRTCClock()->setCurrentTime(sender_timestamp + 1);
147-
strcpy(reply, "OK - clock set");
147+
uint32_t now = getRTCClock()->getCurrentTime();
148+
DateTime dt = DateTime(now);
149+
sprintf(reply, "OK - clock set: %02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
148150
} else {
149151
strcpy(reply, "ERR: clock cannot go backwards");
150152
}
@@ -161,7 +163,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
161163
uint32_t curr = getRTCClock()->getCurrentTime();
162164
if (secs > curr) {
163165
getRTCClock()->setCurrentTime(secs);
164-
strcpy(reply, "(OK - clock set!)");
166+
uint32_t now = getRTCClock()->getCurrentTime();
167+
DateTime dt = DateTime(now);
168+
sprintf(reply, "OK - clock set: %02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
165169
} else {
166170
strcpy(reply, "(ERR: clock cannot go backwards)");
167171
}

0 commit comments

Comments
 (0)