MCPcopy Create free account
hub / github.com/apple/foundationdb / timer_int

Function timer_int

flow/Platform.actor.cpp:1882–1902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1880};
1881
1882uint64_t timer_int() {
1883#ifdef _WIN32
1884 static const int64_t FILETIME_C_EPOCH =
1885 11644473600LL *
1886 10000000LL; // Difference between FILETIME epoch (1601) and Unix epoch (1970) in 100ns FILETIME ticks
1887 FILETIME fileTime;
1888 GetSystemTimeAsFileTime(&fileTime);
1889 static_assert(sizeof(fileTime) == sizeof(uint64_t), "FILETIME size wrong");
1890 return (*(uint64_t*)&fileTime - FILETIME_C_EPOCH);
1891#elif defined(__linux__) || defined(__FreeBSD__)
1892 struct timespec ts;
1893 clock_gettime(CLOCK_REALTIME, &ts);
1894 return uint64_t(ts.tv_sec) * 1e9 + ts.tv_nsec;
1895#elif defined(__APPLE__)
1896 struct timeval tv;
1897 gettimeofday(&tv, nullptr);
1898 return uint64_t(tv.tv_sec) * 1e9 + (tv.tv_usec * 1e3);
1899#else
1900#error Port me!
1901#endif
1902};
1903
1904void getLocalTime(const time_t* timep, struct tm* result) {
1905#ifdef _WIN32

Callers 8

logMethod · 0.85
logMethod · 0.85
changeMethod · 0.85
KAIOLogBlockEventMethod · 0.85
KAIOLogEventMethod · 0.85
catchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected