Fixes for system_time_saved_at_.
GitOrigin-RevId: 1effe236b00a00facfec0d6492bd60fe52faa737
This commit is contained in:
parent
41b09d9c31
commit
bd559bf13a
@ -93,7 +93,7 @@ Status Global::init(const TdParameters ¶meters, ActorId<Td> td, unique_ptr<T
|
|||||||
td_db_ = std::move(td_db_ptr);
|
td_db_ = std::move(td_db_ptr);
|
||||||
|
|
||||||
string saved_diff_str = td_db()->get_binlog_pmc()->get("server_time_difference");
|
string saved_diff_str = td_db()->get_binlog_pmc()->get("server_time_difference");
|
||||||
auto system_time = Clocks::system();
|
auto system_time = max(1577285000.0, Clocks::system());
|
||||||
auto default_time_difference = system_time - Time::now();
|
auto default_time_difference = system_time - Time::now();
|
||||||
if (saved_diff_str.empty()) {
|
if (saved_diff_str.empty()) {
|
||||||
server_time_difference_ = default_time_difference;
|
server_time_difference_ = default_time_difference;
|
||||||
@ -128,7 +128,7 @@ void Global::update_server_time_difference(double diff) {
|
|||||||
|
|
||||||
void Global::save_server_time() {
|
void Global::save_server_time() {
|
||||||
auto t = Time::now();
|
auto t = Time::now();
|
||||||
if (system_time_saved_at_.load(std::memory_order_relaxed) + 10 < t) {
|
if (server_time_difference_was_updated_ && system_time_saved_at_.load(std::memory_order_relaxed) + 10 < t) {
|
||||||
system_time_saved_at_ = t;
|
system_time_saved_at_ = t;
|
||||||
do_save_server_time_difference();
|
do_save_server_time_difference();
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ class Global : public ActorContext {
|
|||||||
std::atomic<double> dns_time_difference_{0.0};
|
std::atomic<double> dns_time_difference_{0.0};
|
||||||
std::atomic<bool> dns_time_difference_was_updated_{false};
|
std::atomic<bool> dns_time_difference_was_updated_{false};
|
||||||
std::atomic<bool> close_flag_{false};
|
std::atomic<bool> close_flag_{false};
|
||||||
std::atomic<double> system_time_saved_at_{0.0};
|
std::atomic<double> system_time_saved_at_{-1e10};
|
||||||
|
|
||||||
std::vector<std::shared_ptr<NetStatsCallback>> net_stats_file_callbacks_;
|
std::vector<std::shared_ptr<NetStatsCallback>> net_stats_file_callbacks_;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user