mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 16:58:30 +00:00
parent
a988896048
commit
f317a47cd8
15 changed files with 315 additions and 253 deletions
|
@ -50,14 +50,18 @@ int64_t TimeValToWindowsTime(struct timeval) libcesque nosideeffect;
|
|||
struct timeval WindowsDurationToTimeVal(int64_t) libcesque nosideeffect;
|
||||
struct timespec WindowsDurationToTimeSpec(int64_t) libcesque nosideeffect;
|
||||
|
||||
static inline struct NtFileTime MakeFileTime(int64_t x) {
|
||||
return (struct NtFileTime){(uint32_t)x, (uint32_t)(x >> 32)};
|
||||
}
|
||||
#define MakeFileTime(x) \
|
||||
({ \
|
||||
int64_t __x = x; \
|
||||
(struct NtFileTime){(uint32_t)__x, (uint32_t)(__x >> 32)}; \
|
||||
})
|
||||
|
||||
static inline int64_t ReadFileTime(struct NtFileTime t) {
|
||||
uint64_t x = t.dwHighDateTime;
|
||||
return x << 32 | t.dwLowDateTime;
|
||||
}
|
||||
#define ReadFileTime(t) \
|
||||
({ \
|
||||
struct NtFileTime __t = t; \
|
||||
uint64_t x = __t.dwHighDateTime; \
|
||||
(int64_t)(x << 32 | __t.dwLowDateTime); \
|
||||
})
|
||||
|
||||
#define FileTimeToTimeSpec(x) WindowsTimeToTimeSpec(ReadFileTime(x))
|
||||
#define FileTimeToTimeVal(x) WindowsTimeToTimeVal(ReadFileTime(x))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue