mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 15:03:34 +00:00
- Remove most __ASSEMBLER__ __LINKER__ ifdefs - Rename libc/intrin/bits.h to libc/serialize.h - Block pthread cancelation in fchmodat() polyfill - Remove `clang-format off` statements in third_party
13 lines
467 B
C
13 lines
467 B
C
#ifndef COSMOPOLITAN_LIBC_TIME_CLOCKSTONANOS_INTERNAL_H_
|
|
#define COSMOPOLITAN_LIBC_TIME_CLOCKSTONANOS_INTERNAL_H_
|
|
COSMOPOLITAN_C_START_
|
|
|
|
static inline uint64_t ClocksToNanos(uint64_t x, uint64_t y) {
|
|
// approximation of round(x*.323018) which is usually
|
|
// the ratio between inva rdtsc ticks and nanoseconds
|
|
uint128_t difference = x - y;
|
|
return (difference * 338709) >> 20;
|
|
}
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* COSMOPOLITAN_LIBC_TIME_CLOCKSTONANOS_INTERNAL_H_ */
|