diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-02-11 12:14:00 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-02-11 12:14:00 (GMT) |
commit | 0efa7c32aaf21a29b42b5926cc116007056843be (patch) | |
tree | 882f663a5dd0e65694bf6077b71086dd77fd7ff8 /3rdParty/Boost/libs/thread/src/win32/timeconv.inl | |
parent | 1d20eabbc32274b491b4c2bedf73d19933d97bfd (diff) | |
download | swift-contrib-0efa7c32aaf21a29b42b5926cc116007056843be.zip swift-contrib-0efa7c32aaf21a29b42b5926cc116007056843be.tar.bz2 |
Moved some modules into separate git modules.
Diffstat (limited to '3rdParty/Boost/libs/thread/src/win32/timeconv.inl')
m--------- | 3rdParty/Boost | 0 | ||||
-rw-r--r-- | 3rdParty/Boost/libs/thread/src/win32/timeconv.inl | 130 |
2 files changed, 0 insertions, 130 deletions
diff --git a/3rdParty/Boost b/3rdParty/Boost new file mode 160000 +Subproject 3bbdbc8cf1996f23d9a366da8bac0f97be6ad79 diff --git a/3rdParty/Boost/libs/thread/src/win32/timeconv.inl b/3rdParty/Boost/libs/thread/src/win32/timeconv.inl deleted file mode 100644 index 5ec3b17..0000000 --- a/3rdParty/Boost/libs/thread/src/win32/timeconv.inl +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (C) 2001-2003 -// William E. Kempf -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// boostinspect:nounnamed - -namespace { -const int MILLISECONDS_PER_SECOND = 1000; -const int NANOSECONDS_PER_SECOND = 1000000000; -const int NANOSECONDS_PER_MILLISECOND = 1000000; - -const int MICROSECONDS_PER_SECOND = 1000000; -const int NANOSECONDS_PER_MICROSECOND = 1000; - -inline void to_time(int milliseconds, boost::xtime& xt) -{ - int res = 0; - res = boost::xtime_get(&xt, boost::TIME_UTC); - assert(res == boost::TIME_UTC); - - xt.sec += (milliseconds / MILLISECONDS_PER_SECOND); - xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) * - NANOSECONDS_PER_MILLISECOND); - - if (xt.nsec >= NANOSECONDS_PER_SECOND) - { - ++xt.sec; - xt.nsec -= NANOSECONDS_PER_SECOND; - } -} - -#if defined(BOOST_HAS_PTHREADS) -inline void to_timespec(const boost::xtime& xt, timespec& ts) -{ - ts.tv_sec = static_cast<int>(xt.sec); - ts.tv_nsec = static_cast<int>(xt.nsec); - if(ts.tv_nsec >= NANOSECONDS_PER_SECOND) - { - ts.tv_sec += ts.tv_nsec / NANOSECONDS_PER_SECOND; - ts.tv_nsec %= NANOSECONDS_PER_SECOND; - } -} - -inline void to_time(int milliseconds, timespec& ts) -{ - boost::xtime xt; - to_time(milliseconds, xt); - to_timespec(xt, ts); -} - -inline void to_timespec_duration(const boost::xtime& xt, timespec& ts) -{ - boost::xtime cur; - int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); - - if (boost::xtime_cmp(xt, cur) <= 0) - { - ts.tv_sec = 0; - ts.tv_nsec = 0; - } - else - { - ts.tv_sec = xt.sec - cur.sec; - ts.tv_nsec = xt.nsec - cur.nsec; - - if( ts.tv_nsec < 0 ) - { - ts.tv_sec -= 1; - ts.tv_nsec += NANOSECONDS_PER_SECOND; - } - if(ts.tv_nsec >= NANOSECONDS_PER_SECOND) - { - ts.tv_sec += ts.tv_nsec / NANOSECONDS_PER_SECOND; - ts.tv_nsec %= NANOSECONDS_PER_SECOND; - } - } -} -#endif - -inline void to_duration(boost::xtime xt, int& milliseconds) -{ - boost::xtime cur; - int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); - - if (boost::xtime_cmp(xt, cur) <= 0) - milliseconds = 0; - else - { - if (cur.nsec > xt.nsec) - { - xt.nsec += NANOSECONDS_PER_SECOND; - --xt.sec; - } - milliseconds = (int)((xt.sec - cur.sec) * MILLISECONDS_PER_SECOND) + - (((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MILLISECOND/2)) / - NANOSECONDS_PER_MILLISECOND); - } -} - -inline void to_microduration(boost::xtime xt, int& microseconds) -{ - boost::xtime cur; - int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); - - if (boost::xtime_cmp(xt, cur) <= 0) - microseconds = 0; - else - { - if (cur.nsec > xt.nsec) - { - xt.nsec += NANOSECONDS_PER_SECOND; - --xt.sec; - } - microseconds = (int)((xt.sec - cur.sec) * MICROSECONDS_PER_SECOND) + - (((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MICROSECOND/2)) / - NANOSECONDS_PER_MICROSECOND); - } -} -} - -// Change Log: -// 1 Jun 01 Initial creation. |