File tree Expand file tree Collapse file tree 1 file changed +43
-4
lines changed
Expand file tree Collapse file tree 1 file changed +43
-4
lines changed Original file line number Diff line number Diff line change 22// Distributed under the Boost Software License, Version 1.0.
33// https://www.boost.org/LICENSE_1_0.txt
44
5- #define _POSIX_C_SOURCE 199309L
5+ #ifdef _WIN32
6+ # define WIN32_LEAN_AND_MEAN
7+ # include <windows.h>
8+ #else
9+ # define _POSIX_C_SOURCE 199309L
10+ #endif
611
712#include <stdio.h>
813#include <stdlib.h>
914#include <stdint.h>
10- #include <time.h>
1115#include <inttypes.h>
1216#include <float.h>
1317#include <fenv.h>
1418
19+ #include "..\LIBRARY\src\bid_conf.h"
20+ #include "..\LIBRARY\src\bid_functions.h"
21+
1522typedef BID_UINT32 Decimal32 ;
1623typedef BID_UINT64 Decimal64 ;
17- #include "../LIBRARY/src/bid_conf.h"
18- #include "../LIBRARY/src/bid_functions.h"
1924typedef BID_UINT128 Decimal128 ;
2025
2126#define K 20000000
@@ -26,6 +31,40 @@ typedef BID_UINT128 Decimal128;
2631#else
2732# define BOOST_DECIMAL_NOINLINE __attribute__ ((noinline))
2833#endif
34+
35+ #ifdef _WIN32
36+ #include <windows.h>
37+
38+ #define CLOCK_MONOTONIC 1
39+
40+ struct timespec
41+ {
42+ long tv_sec ;
43+ long tv_nsec ;
44+ };
45+
46+ int clock_gettime (int clock_id , struct timespec * tp )
47+ {
48+ (void )clock_id ; // Ignore clock_id, always use QPC
49+
50+ static LARGE_INTEGER frequency = { 0 };
51+ LARGE_INTEGER counter ;
52+
53+ if (frequency .QuadPart == 0 )
54+ {
55+ QueryPerformanceFrequency (& frequency );
56+ }
57+
58+ QueryPerformanceCounter (& counter );
59+
60+ tp -> tv_sec = (long )(counter .QuadPart / frequency .QuadPart );
61+ tp -> tv_nsec = (long )(((counter .QuadPart % frequency .QuadPart ) * 1000000000LL ) / frequency .QuadPart );
62+
63+ return 0 ;
64+ }
65+
66+ #else
67+ #include <time.h>
2968#endif
3069
3170uint32_t flag = 0 ;
You can’t perform that action at this time.
0 commit comments