Skip to content

Commit aa6386e

Browse files
committed
Fix timespec: skip if time.h already included (_INC_TIME guard)
1 parent c52dcf9 commit aa6386e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

quant.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ typedef volatile long atomic_int;
144144
#ifndef CLOCK_MONOTONIC
145145
#define CLOCK_MONOTONIC 1
146146
#endif
147-
#if !defined(_TIMESPEC_DEFINED) && !defined(__struct_timespec_defined)
148-
#define _TIMESPEC_DEFINED 1
149-
#define __struct_timespec_defined 1
147+
/* timespec: MSVC 2022+ defines it in time.h, older MSVC doesn't.
148+
* Only define if not already available. */
149+
#if !defined(_TIMESPEC_DEFINED) && !defined(__struct_timespec_defined) && !defined(_INC_TIME)
150150
struct timespec { long tv_sec; long tv_nsec; };
151151
#endif
152152
static inline int clock_gettime(int id, struct timespec* ts) {

0 commit comments

Comments
 (0)