2
0
mirror of https://github.com/boostorg/chrono.git synced 2026-01-25 18:12:13 +00:00

Boost.Chrono: Moved to trunk

[SVN r67698]
This commit is contained in:
Vicente J. Botet Escriba
2011-01-06 00:47:42 +00:00
parent f5eb279eee
commit c183fb72fd
89 changed files with 16342 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
// test_thread_clock.cpp ----------------------------------------------------------//
// Copyright 2009 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#include <boost/chrono/thread_clock.hpp>
#include <boost/type_traits.hpp>
#include <iostream>
using namespace boost::chrono;
void test_thread_clock()
{
#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
std::cout << "thread_clock test" << std::endl;
thread_clock::duration delay = milliseconds(5);
thread_clock::time_point start = thread_clock::now();
while (thread_clock::now() - start <= delay)
;
thread_clock::time_point stop = thread_clock::now();
thread_clock::duration elapsed = stop - start;
std::cout << "paused " << nanoseconds(elapsed).count() << " nanoseconds\n";
start = thread_clock::now();
stop = thread_clock::now();
std::cout << "thread_clock resolution estimate: " << nanoseconds(stop-start).count() << " nanoseconds\n";
#else
std::cout << "thread_clock not available\n";
#endif
}
int main()
{
test_thread_clock();
return 0;
}