mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 21:56:35 +00:00
Add NTP drift information
Add NTP drift information
This commit is contained in:
parent
c36f93987c
commit
99f680da57
@ -2013,7 +2013,8 @@ void PerformEverySecond(void)
|
|||||||
|
|
||||||
if (ntp_synced_message) {
|
if (ntp_synced_message) {
|
||||||
// Moved here to fix syslog UDP exception 9 during RtcSecond
|
// Moved here to fix syslog UDP exception 9 during RtcSecond
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
|
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NTP: Drift %d, (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"),
|
||||||
|
DriftTime(), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
|
||||||
ntp_synced_message = false;
|
ntp_synced_message = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +46,16 @@ uint32_t standard_time = 0;
|
|||||||
uint32_t ntp_time = 0;
|
uint32_t ntp_time = 0;
|
||||||
uint32_t midnight = 0;
|
uint32_t midnight = 0;
|
||||||
uint32_t restart_time = 0;
|
uint32_t restart_time = 0;
|
||||||
|
int32_t drift_time = 0;
|
||||||
int32_t time_timezone = 0;
|
int32_t time_timezone = 0;
|
||||||
uint8_t midnight_now = 0;
|
uint8_t midnight_now = 0;
|
||||||
uint8_t ntp_sync_minute = 0;
|
uint8_t ntp_sync_minute = 0;
|
||||||
|
|
||||||
|
int32_t DriftTime(void)
|
||||||
|
{
|
||||||
|
return drift_time;
|
||||||
|
}
|
||||||
|
|
||||||
String GetBuildDateAndTime(void)
|
String GetBuildDateAndTime(void)
|
||||||
{
|
{
|
||||||
// "2017-03-07T11:08:02" - ISO8601:2004
|
// "2017-03-07T11:08:02" - ISO8601:2004
|
||||||
@ -356,6 +362,7 @@ void RtcSecond(void)
|
|||||||
ntp_time = sntp_get_current_timestamp();
|
ntp_time = sntp_get_current_timestamp();
|
||||||
if (ntp_time > 1451602800) { // Fix NTP bug in core 2.4.1/SDK 2.2.1 (returns Thu Jan 01 08:00:10 1970 after power on)
|
if (ntp_time > 1451602800) { // Fix NTP bug in core 2.4.1/SDK 2.2.1 (returns Thu Jan 01 08:00:10 1970 after power on)
|
||||||
ntp_force_sync = false;
|
ntp_force_sync = false;
|
||||||
|
if (utc_time > 1451602800) { drift_time = ntp_time - utc_time; }
|
||||||
utc_time = ntp_time;
|
utc_time = ntp_time;
|
||||||
ntp_sync_minute = 60; // Sync so block further requests
|
ntp_sync_minute = 60; // Sync so block further requests
|
||||||
if (restart_time == 0) {
|
if (restart_time == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user