mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix sender report building and parsing
This commit is contained in:
@@ -15,15 +15,15 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
uint64_t ConvertToNtpTime(int64_t time_us) {
|
||||
int64_t ConvertToNtpTime(int64_t time_us) {
|
||||
constexpr int64_t kMicrosecondsPerSecond = 1000000;
|
||||
constexpr uint64_t kNtpFractionalUnit = 0x100000000; // 2^32
|
||||
uint32_t seconds = static_cast<uint32_t>(time_us / kMicrosecondsPerSecond);
|
||||
uint32_t fraction =
|
||||
uint32_t fractions =
|
||||
static_cast<uint32_t>((time_us % kMicrosecondsPerSecond) *
|
||||
kNtpFractionalUnit / kMicrosecondsPerSecond);
|
||||
uint64_t ntp_time = (static_cast<uint64_t>(seconds) << 32) | fraction;
|
||||
return ntp_time;
|
||||
|
||||
return seconds * kNtpFractionalUnit + fractions;
|
||||
}
|
||||
|
||||
int64_t SystemClock::CurrentTimeNs() {
|
||||
|
||||
Reference in New Issue
Block a user