include/TimeCommon.h
include/TimeCommon.h
Namespaces
Classes
Source code
// Copyright (c) 2022, Edgeware AB. All rights reserved.
#pragma once
#include <chrono>
#include <cstdint>
#include <fstream>
#include <sstream>
namespace TimeCommon {
enum class StratumLevel {
UnknownStratum,
stratum0,
stratum1,
stratum2,
stratum3,
stratum4,
};
struct TAIStatus {
StratumLevel mStratum = StratumLevel::UnknownStratum;
bool mHasLock = false;
};
// Little endian
// Minimum size packet is 64 - bytes
struct TimeStructure {
uint64_t t1 = 0; // 8-bytes / Total 8-bytes == Client time T1
uint64_t t2 = 0; // 8-bytes / Total 16-bytes == Server
uint64_t t3 = 0; // 8-bytes / Total 24-bytes
uint64_t t4 = 0; // 8-bytes / Total 32-bytes
uint64_t token = 0; // 8-bytes / Total 40-bytes == t1 ^ key
uint64_t dummy1 = 0; // 8-bytes / Total 48-bytes == for future use
uint64_t dummy2 = 0; // 8-bytes / Total 56-bytes == for future use
uint64_t dummy3 = 0; // 8-bytes / Total 64-bytes == for future use
};
uint64_t getMonotonicClockMicro();
TimeCommon::TAIStatus getStatus();
int64_t getTAIMicro();
} // namespace TimeCommon
Updated on 2022-06-22 at 16:53:25 +0200