MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / utc

Function utc

proto/fbe.cpp:79–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79uint64_t utc()
80{
81#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
82 struct timespec timestamp;
83 if (clock_gettime(CLOCK_REALTIME, &timestamp) != 0)
84 throw std::runtime_error("Cannot get value of CLOCK_REALTIME timer!");
85 return (timestamp.tv_sec * 1000000000) + timestamp.tv_nsec;
86#elif defined(_WIN32) || defined(_WIN64)
87 FILETIME ft;
88 GetSystemTimePreciseAsFileTime(&ft);
89
90 ULARGE_INTEGER result;
91 result.LowPart = ft.dwLowDateTime;
92 result.HighPart = ft.dwHighDateTime;
93 return (result.QuadPart - 116444736000000000ull) * 100;
94#endif
95}
96
97uint8_t unhex(char ch)
98{

Callers 3

StructSimpleMethod · 0.70
StructOptionalMethod · 0.70
get_fieldsMethod · 0.70

Calls

no outgoing calls

Tested by 3

StructSimpleMethod · 0.56
StructOptionalMethod · 0.56
get_fieldsMethod · 0.56