author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (C) 2001-2003 |
sl@0 | 2 |
// William E. Kempf |
sl@0 | 3 |
// |
sl@0 | 4 |
// Distributed under the Boost Software License, Version 1.0. (See accompanying |
sl@0 | 5 |
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
sl@0 | 6 |
|
sl@0 | 7 |
#ifndef BOOST_XTIME_WEK070601_HPP |
sl@0 | 8 |
#define BOOST_XTIME_WEK070601_HPP |
sl@0 | 9 |
|
sl@0 | 10 |
#include <boost/thread/detail/config.hpp> |
sl@0 | 11 |
|
sl@0 | 12 |
#include <boost/cstdint.hpp> |
sl@0 | 13 |
|
sl@0 | 14 |
namespace boost { |
sl@0 | 15 |
|
sl@0 | 16 |
enum xtime_clock_types |
sl@0 | 17 |
{ |
sl@0 | 18 |
TIME_UTC=1 |
sl@0 | 19 |
// TIME_TAI, |
sl@0 | 20 |
// TIME_MONOTONIC, |
sl@0 | 21 |
// TIME_PROCESS, |
sl@0 | 22 |
// TIME_THREAD, |
sl@0 | 23 |
// TIME_LOCAL, |
sl@0 | 24 |
// TIME_SYNC, |
sl@0 | 25 |
// TIME_RESOLUTION |
sl@0 | 26 |
}; |
sl@0 | 27 |
|
sl@0 | 28 |
struct xtime |
sl@0 | 29 |
{ |
sl@0 | 30 |
#if defined(BOOST_NO_INT64_T) |
sl@0 | 31 |
typedef int_fast32_t xtime_sec_t; //INT_FAST32_MIN <= sec <= INT_FAST32_MAX |
sl@0 | 32 |
#else |
sl@0 | 33 |
typedef int_fast64_t xtime_sec_t; //INT_FAST64_MIN <= sec <= INT_FAST64_MAX |
sl@0 | 34 |
#endif |
sl@0 | 35 |
|
sl@0 | 36 |
typedef int_fast32_t xtime_nsec_t; //0 <= xtime.nsec < NANOSECONDS_PER_SECOND |
sl@0 | 37 |
|
sl@0 | 38 |
xtime_sec_t sec; |
sl@0 | 39 |
xtime_nsec_t nsec; |
sl@0 | 40 |
}; |
sl@0 | 41 |
|
sl@0 | 42 |
int BOOST_THREAD_DECL xtime_get(struct xtime* xtp, int clock_type); |
sl@0 | 43 |
|
sl@0 | 44 |
inline int xtime_cmp(const xtime& xt1, const xtime& xt2) |
sl@0 | 45 |
{ |
sl@0 | 46 |
if (xt1.sec == xt2.sec) |
sl@0 | 47 |
return (int)(xt1.nsec - xt2.nsec); |
sl@0 | 48 |
else |
sl@0 | 49 |
return (xt1.sec > xt2.sec) ? 1 : -1; |
sl@0 | 50 |
} |
sl@0 | 51 |
|
sl@0 | 52 |
} // namespace boost |
sl@0 | 53 |
|
sl@0 | 54 |
#endif //BOOST_XTIME_WEK070601_HPP |