mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix show ntp_time (as local time)
This commit is contained in:
@@ -38,6 +38,7 @@ import { AuthenticatedContext } from 'contexts/authentication';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import { NTPSyncStatus, NetworkConnectionStatus } from 'types';
|
||||
import { useInterval } from 'utils';
|
||||
import { formatDateTime } from 'utils/time';
|
||||
|
||||
import RestartMonitor from './RestartMonitor';
|
||||
|
||||
@@ -138,7 +139,7 @@ const SystemStatus = () => {
|
||||
case NTPSyncStatus.NTP_INACTIVE:
|
||||
return LL.INACTIVE(0);
|
||||
case NTPSyncStatus.NTP_ACTIVE:
|
||||
return LL.ACTIVE();
|
||||
return LL.ACTIVE() + (data.ntp_time !== undefined) ? ' (' + formatDateTime(data.ntp_time) + ')' : '';
|
||||
default:
|
||||
return LL.UNKNOWN();
|
||||
}
|
||||
|
||||
@@ -68,6 +68,12 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
||||
}
|
||||
return 0;
|
||||
}();
|
||||
time_t now = time(nullptr);
|
||||
if (now > 1500000000L) {
|
||||
char t[25];
|
||||
strftime(t, sizeof(t), "%FT%T", localtime(&now));
|
||||
root["ntp_time"] = t;
|
||||
}
|
||||
#endif
|
||||
|
||||
root["ap_status"] = EMSESP::esp8266React.apStatus();
|
||||
|
||||
Reference in New Issue
Block a user