diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 4de80cebe712..359289b3d283 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -2,6 +2,7 @@ * 6.6.0.10 20190905 * Redesign Tuya support by Shantur Rathore (#6353) * Add command Reset 99 to reset bootcount to zero (#684, #6351) + * Change command Time 1/2/3 to select JSON time format ISO, ISO + Epoch or Epoch for legacy reason * * 6.6.0.9 20190828 * Change theoretical baudrate range to 300..19660500 bps in 300 increments (#6294) diff --git a/sonoff/support.ino b/sonoff/support.ino index e6707510e6e6..035a1d31d98a 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -876,13 +876,13 @@ char* ResponseGetTime(uint32_t format, char* time_str) { switch (format) { case 1: - snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); + snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\",\"Epoch\":%u"), GetDateAndTime(DT_LOCAL).c_str(), UtcTime()); break; case 2: snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":%u"), UtcTime()); break; default: - snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\",\"Epoch\":%u"), GetDateAndTime(DT_LOCAL).c_str(), UtcTime()); + snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); } return time_str; } diff --git a/sonoff/support_command.ino b/sonoff/support_command.ino index a634ac48f4d1..8497497abcb6 100644 --- a/sonoff/support_command.ino +++ b/sonoff/support_command.ino @@ -1271,8 +1271,8 @@ void CmndReset(void) void CmndTime(void) { // payload 0 = (re-)enable NTP -// payload 1 = Time format {"Time":"2019-09-04T14:31:29","Epoch":1567600289} -// payload 2 = Time format {"Time":"2019-09-04T14:31:29"} +// payload 1 = Time format {"Time":"2019-09-04T14:31:29"} +// payload 2 = Time format {"Time":"2019-09-04T14:31:29","Epoch":1567600289} // payload 3 = Time format {"Time":1567600289} // payload 4 = reserved // payload 1451602800 - disable NTP and set time to epoch @@ -1283,7 +1283,7 @@ void CmndTime(void) Settings.flag2.time_format = XdrvMailbox.payload -1; format = Settings.flag2.time_format; } else { - format = 0; // {"Time":"2019-09-04T14:31:29","Epoch":1567600289} + format = 1; // {"Time":"2019-09-04T14:31:29","Epoch":1567600289} RtcSetTime(XdrvMailbox.payload); } }