Add more logging in to_unix_time.
GitOrigin-RevId: 1e191c31e4be4a29584844f27b098a21811daffd
This commit is contained in:
parent
04a002d9f3
commit
c5f3b2223c
@ -102,6 +102,9 @@ Status Global::init(const TdParameters ¶meters, ActorId<Td> td, unique_ptr<T
|
|||||||
ServerTimeDiff saved_diff;
|
ServerTimeDiff saved_diff;
|
||||||
unserialize(saved_diff, saved_diff_str).ensure();
|
unserialize(saved_diff, saved_diff_str).ensure();
|
||||||
|
|
||||||
|
saved_diff_ = saved_diff.diff;
|
||||||
|
saved_system_time_ = saved_diff.system_time;
|
||||||
|
|
||||||
double diff = saved_diff.diff + default_time_difference;
|
double diff = saved_diff.diff + default_time_difference;
|
||||||
if (saved_diff.system_time > system_time) {
|
if (saved_diff.system_time > system_time) {
|
||||||
double time_backwards_fix = saved_diff.system_time - system_time;
|
double time_backwards_fix = saved_diff.system_time - system_time;
|
||||||
@ -129,8 +132,9 @@ Status Global::init(const TdParameters ¶meters, ActorId<Td> td, unique_ptr<T
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Global::to_unix_time(double server_time) {
|
int32 Global::to_unix_time(double server_time) const {
|
||||||
LOG_CHECK(1.0 <= server_time && server_time <= 2140000000.0) << server_time << " " << Clocks::system();
|
LOG_CHECK(1.0 <= server_time && server_time <= 2140000000.0)
|
||||||
|
<< server_time << " " << Clocks::system() << " " << saved_diff_ << " " << saved_system_time_;
|
||||||
return static_cast<int32>(server_time);
|
return static_cast<int32>(server_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +398,8 @@ class Global : public ActorContext {
|
|||||||
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_{-1e10};
|
std::atomic<double> system_time_saved_at_{-1e10};
|
||||||
|
double saved_diff_ = 0.0;
|
||||||
|
double saved_system_time_ = 0.0;
|
||||||
|
|
||||||
#if !TD_HAVE_ATOMIC_SHARED_PTR
|
#if !TD_HAVE_ATOMIC_SHARED_PTR
|
||||||
std::mutex dh_config_mutex_;
|
std::mutex dh_config_mutex_;
|
||||||
@ -418,7 +420,7 @@ class Global : public ActorContext {
|
|||||||
|
|
||||||
std::unordered_map<int64, int64> location_access_hashes_;
|
std::unordered_map<int64, int64> location_access_hashes_;
|
||||||
|
|
||||||
static int32 to_unix_time(double server_time);
|
int32 to_unix_time(double server_time) const;
|
||||||
|
|
||||||
void do_save_server_time_difference();
|
void do_save_server_time_difference();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user