Line | |
---|
1 | // Copyright (C) 2001-2003
|
---|
2 | // William E. Kempf
|
---|
3 | //
|
---|
4 | // Permission to use, copy, modify, distribute and sell this software
|
---|
5 | // and its documentation for any purpose is hereby granted without fee,
|
---|
6 | // provided that the above copyright notice appear in all copies and
|
---|
7 | // that both that copyright notice and this permission notice appear
|
---|
8 | // in supporting documentation. William E. Kempf makes no representations
|
---|
9 | // about the suitability of this software for any purpose.
|
---|
10 | // It is provided "as is" without express or implied warranty.
|
---|
11 |
|
---|
12 | #ifndef BOOST_XTIME_WEK070601_HPP
|
---|
13 | #define BOOST_XTIME_WEK070601_HPP
|
---|
14 |
|
---|
15 | #include <boost/thread/detail/config.hpp>
|
---|
16 |
|
---|
17 | #include <boost/cstdint.hpp>
|
---|
18 |
|
---|
19 | namespace boost {
|
---|
20 |
|
---|
21 | enum xtime_clock_types
|
---|
22 | {
|
---|
23 | TIME_UTC=1
|
---|
24 | // TIME_TAI,
|
---|
25 | // TIME_MONOTONIC,
|
---|
26 | // TIME_PROCESS,
|
---|
27 | // TIME_THREAD,
|
---|
28 | // TIME_LOCAL,
|
---|
29 | // TIME_SYNC,
|
---|
30 | // TIME_RESOLUTION
|
---|
31 | };
|
---|
32 |
|
---|
33 | struct xtime
|
---|
34 | {
|
---|
35 | #if defined(BOOST_NO_INT64_T)
|
---|
36 | typedef int_fast32_t xtime_sec_t; //INT_FAST32_MIN <= sec <= INT_FAST32_MAX
|
---|
37 | #else
|
---|
38 | typedef int_fast64_t xtime_sec_t; //INT_FAST64_MIN <= sec <= INT_FAST64_MAX
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | typedef int_fast32_t xtime_nsec_t; //0 <= xtime.nsec < NANOSECONDS_PER_SECOND
|
---|
42 |
|
---|
43 | xtime_sec_t sec;
|
---|
44 | xtime_nsec_t nsec;
|
---|
45 | };
|
---|
46 |
|
---|
47 | int BOOST_THREAD_DECL xtime_get(struct xtime* xtp, int clock_type);
|
---|
48 |
|
---|
49 | inline int xtime_cmp(const xtime& xt1, const xtime& xt2)
|
---|
50 | {
|
---|
51 | if (xt1.sec == xt2.sec)
|
---|
52 | return (int)(xt1.nsec - xt2.nsec);
|
---|
53 | else
|
---|
54 | return (xt1.sec > xt2.sec) ? 1 : -1;
|
---|
55 | }
|
---|
56 |
|
---|
57 | } // namespace boost
|
---|
58 |
|
---|
59 | #endif //BOOST_XTIME_WEK070601_HPP
|
---|
Note: See
TracBrowser
for help on using the repository browser.