fix ts is negative issue.
This commit is contained in:
parent
822745e066
commit
7cc03ad7e8
@ -230,6 +230,20 @@ SensorScheduler::SensorScheduler() {
|
|||||||
}
|
}
|
||||||
start_timestamp_ = std::stol(root["schedule_start_timestamp"].asString());
|
start_timestamp_ = std::stol(root["schedule_start_timestamp"].asString());
|
||||||
start_ts_str_ = root["schedule_start_time"].asString();
|
start_ts_str_ = root["schedule_start_time"].asString();
|
||||||
|
long current_ts = GetLocalTs();
|
||||||
|
if (current_ts < start_timestamp_) {
|
||||||
|
zlog_warn(zbt, "current ts: %ld less than start ts: %ld, go to adjust it", current_ts, start_timestamp_);
|
||||||
|
start_timestamp_ = current_ts;
|
||||||
|
start_ts_str_ = GetUTCTime(current_ts);
|
||||||
|
root["schedule_start_timestamp"] = std::to_string(start_timestamp_);
|
||||||
|
root["schedule_start_time"] = start_ts_str_;
|
||||||
|
|
||||||
|
Json::StyledStreamWriter streamWriter;
|
||||||
|
std::ofstream out_file(SCHEDULE_CONFIG);
|
||||||
|
streamWriter.write(out_file, root);
|
||||||
|
out_file.close();
|
||||||
|
}
|
||||||
|
|
||||||
eigen_value_send_interval_ = root["eigen_value_send_interval"].asInt();
|
eigen_value_send_interval_ = root["eigen_value_send_interval"].asInt();
|
||||||
eigen_value_send_duration_ = root["eigen_value_send_duration"].asInt();
|
eigen_value_send_duration_ = root["eigen_value_send_duration"].asInt();
|
||||||
wave_form_send_interval_ = root["wave_form_send_interval"].asInt();
|
wave_form_send_interval_ = root["wave_form_send_interval"].asInt();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user