mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-31 11:09:10 +03:00
fixes install time in NVS
This commit is contained in:
@@ -347,23 +347,22 @@ void System::get_partition_info() {
|
|||||||
// get the version from the NVS store, and add to map
|
// get the version from the NVS store, and add to map
|
||||||
if (is_valid) {
|
if (is_valid) {
|
||||||
PartitionInfo p_info;
|
PartitionInfo p_info;
|
||||||
p_info.size = part->size / 1024; // set size in KB
|
// default partition info
|
||||||
|
p_info.version = "";
|
||||||
|
p_info.install_date = "";
|
||||||
|
p_info.size = part->size / 1024; // set size in KB
|
||||||
|
|
||||||
// if there is an entry for this partition in NVS, get the version from NVS, if not found, use empty string
|
// if there is an entry for this partition in NVS, get the version from NVS, if not found, use empty string
|
||||||
if (EMSESP::nvs_.isKey(part->label)) {
|
if (EMSESP::nvs_.isKey(part->label)) {
|
||||||
p_info.version = EMSESP::nvs_.getString(part->label).c_str();
|
p_info.version = EMSESP::nvs_.getString(part->label).c_str();
|
||||||
} else {
|
|
||||||
p_info.version = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get install date from NTP if active and add
|
// get install date from NTP if active and add
|
||||||
if (ntp_connected_) {
|
if (ntp_connected_) {
|
||||||
char time_string[25];
|
char time_string[25];
|
||||||
time_t now = time(nullptr) - uuid::get_uptime_sec();
|
time_t now = time(nullptr);
|
||||||
strftime(time_string, sizeof(time_string), "%FT%T%z", localtime(&now));
|
strftime(time_string, sizeof(time_string), "%FT%T", localtime(&now));
|
||||||
p_info.install_date = time_string;
|
p_info.install_date = time_string;
|
||||||
} else {
|
|
||||||
p_info.install_date = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partition_info_[part->label] = p_info;
|
partition_info_[part->label] = p_info;
|
||||||
|
|||||||
Reference in New Issue
Block a user