File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ bool TfBuilderRpcImpl::sendTfBuilderUpdate()
212212
213213 auto lRet = mTfSchedulerRpcClient .TfBuilderUpdate (lUpdate);
214214 if (!lRet) {
215- LOG (WARN) << " Sending TfBuilder update failed" ;
215+ LOG (WARN) << " Sending TfBuilder status update failed. " ;
216216 }
217217 return lRet;
218218}
Original file line number Diff line number Diff line change @@ -34,8 +34,12 @@ void TfSchedulerTfBuilderInfo::updateTfBuilderInfo(const TfBuilderUpdateMessage
3434 using namespace std ::chrono_literals;
3535 const auto lLocalTime = std::chrono::system_clock::now ();
3636
37+ // recreate timepoint from the received millisecond time stamp
38+ const std::chrono::milliseconds lUpdateDuration (pTfBuilderUpdate.info ().last_update_t ());
39+ const std::chrono::time_point<std::chrono::system_clock> lUpdateTimepoint (lUpdateDuration);
40+
3741 // check for system time drifts; account for gRPC latency
38- const auto lTimeDiff = lLocalTime - std::chrono::system_clock::from_time_t (pTfBuilderUpdate. info (). last_update_t ()) ;
42+ const auto lTimeDiff = lLocalTime - lUpdateTimepoint ;
3943 if (lTimeDiff < 0s || lTimeDiff > 1s) {
4044 LOG (WARNING) << " Large system clock drift detected: "
4145 << std::chrono::duration_cast<std::chrono::milliseconds>(lTimeDiff).count ()
Original file line number Diff line number Diff line change @@ -62,12 +62,21 @@ std::string to_string(const ProcessTypePB pType) {
6262 return std::string (" UnknownType" );
6363}
6464
65- std::tuple<std::string, std::time_t > getCurrentTimeString () {
65+ // human readable and milliseconds since epoch
66+ std::tuple<std::string, std::uint64_t > getCurrentTimeString () {
6667 using namespace std ::chrono;
6768 std::ostringstream ss;
68- const auto lTimet = std::chrono::system_clock::to_time_t (system_clock::now ());
69+ const auto lNow = system_clock::now ();
70+
71+ // get human readable string
72+ const auto lTimet = std::chrono::system_clock::to_time_t (lNow);
6973 ss << std::put_time (gmtime (&lTimet), " %FT%TZ" );
70- return { ss.str (), lTimet };
74+
75+ // get milliseconds
76+ const auto lSinceEpoch = lNow.time_since_epoch ();
77+ const auto lMillis = std::chrono::duration_cast<std::chrono::milliseconds>(lSinceEpoch).count ();
78+
79+ return { ss.str (), lMillis };
7180}
7281
7382template <>
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ namespace DataDistribution
3939namespace ConsulImpl {
4040
4141std::string to_string (const ProcessTypePB pType);
42- std::tuple<std::string, std::time_t > getCurrentTimeString ();
42+ std::tuple<std::string, std::uint64_t > getCurrentTimeString ();
4343
4444class BasicInfo ;
4545class PartitionInfo ;
You can’t perform that action at this time.
0 commit comments