1// time2_demo.output ----------------------------------------------------------// 2 3// Copyright 2008 Howard Hinnant 4// Copyright 2008 Beman Dawes 5 6// Distributed under the Boost Software License, Version 1.0. 7// See http://www.boost.org/LICENSE_1_0.txt 8 9Running basic examples 10sleep_for 3000000 microseconds 11sleep_for 1 microseconds 12sleep_until 10:47:17.728293 which is 4499340 microseconds away 13try_lock_for 30000 microseconds 14try_lock_until 10:47:17.728285 which is 4499303 microseconds away 15wait_for 60000000 microseconds 16wait_until 10:47:17.728285 which is 4499264 microseconds away 17sleep_for 250000 microseconds 18sleep_until 10:47:14.729077 which is 1499979 microseconds away 19*************** 20* testStdUser * 21*************** 22100 hours expressed as hours = 100 23100 hours expressed as nanoseconds = 360000000000000 24200 hours expressed as nanoseconds = 720000000000000 25300 hours expressed as nanoseconds = 1080000000000000 26hr = ns; // does not compile 27hr * ns; // does not compile 28duration<double> has count() = 2.5 29seconds sec = duration<double> won't compile 30seconds has count() = 2 31 32************* 33* testUser1 * 34************* 35Speed = 24.5872 meters/sec 36Acceleration = 9.81456 meters/sec^2 37Distance = 13.5204 meters 38There are 125/201168 miles/meter which is approximately 0.000621371 39There are 201168/125 meters/mile which is approximately 1609.34 401 attosecond is 1e-18 seconds 41sec = as; // compiles 421 second is 1e+18 attoseconds 43as = sec; // compiles 44 45************* 46* testUser2 * 47************* 48100 years expressed as years = 100 49100 years expressed as nanoseconds = 3155695200000000000 50200 years expressed as nanoseconds = 6311390400000000000 51300 years expressed as nanoseconds = inf 52yr = ns; // does not compile 53ps = yr; // does not compile 54100 years expressed as picoseconds = inf 550.1 years expressed as picoseconds = 3155695200000000000 56200 million years ago encoded in years: -200000000 57200 million years ago encoded in days: -73048500000 58200 million years ago encoded in millennium: -200000 59Demonstrate "uninitialized protection" behavior: 60nan 61 62d = 3e-09 63d = 10800 64d = 0.666667 65d = 10799.999999997 66292 years of hours = 2559672hr 67Add a nanosecond = 9214819200000000001ns 68Find the difference = 1ns 69244,000 years of hours = 2138904000hr 70Add a microsecond = 7700054400000000001us 71Find the difference = 1us 72********* nanoseconds ********* 73The period of nanoseconds is 1e-09 seconds. 74The frequency of nanoseconds is 1e+09 Hz. 75The representation is integral 76The precision is 1e-09 seconds. 77The range is +/- 292.277 years. 78sizeof(nanoseconds) = 8 79********* microseconds ********* 80The period of microseconds is 1e-06 seconds. 81The frequency of microseconds is 1e+06 Hz. 82The representation is integral 83The precision is 1e-06 seconds. 84The range is +/- 292277 years. 85sizeof(microseconds) = 8 86********* milliseconds ********* 87The period of milliseconds is 0.001 seconds. 88The frequency of milliseconds is 1000 Hz. 89The representation is integral 90The precision is 0.001 seconds. 91The range is +/- 2.92277e+08 years. 92sizeof(milliseconds) = 8 93********* seconds ********* 94The period of seconds is 1 seconds. 95The frequency of seconds is 1 Hz. 96The representation is integral 97The precision is 1 seconds. 98The range is +/- 2.92277e+11 years. 99sizeof(seconds) = 8 100********* minutes ********* 101The period of minutes is 60 seconds. 102The frequency of minutes is 0.0166667 Hz. 103The representation is integral 104The precision is 60 seconds. 105The range is +/- 4083.06 years. 106sizeof(minutes) = 4 107********* hours ********* 108The period of hours is 3600 seconds. 109The frequency of hours is 0.000277778 Hz. 110The representation is integral 111The precision is 3600 seconds. 112The range is +/- 244984 years. 113sizeof(hours) = 4 114********* duration<double> ********* 115The period of duration<double> is 1 seconds. 116The frequency of duration<double> is 1 Hz. 117The representation is floating point 118The precision is the most significant 15 decimal digits. 119The range is +/- 5.69666e+300 years. 120sizeof(duration<double>) = 8 121success 122test_with_xtime 123{3,251000} 1243251 milliseconds 125{3,251000} 126{3,0} 127{3,1} 128system_clock test 129paused 5001000 nanoseconds 130system_clock resolution estimate: 0 nanoseconds 131monotonic_clock test 132paused 5000181 nanoseconds 133monotonic_clock resolution estimate: 97 nanoseconds 134high_resolution_clock test 135paused 5000277 nanoseconds 136high_resolution_clock resolution estimate: 96 nanoseconds 137mixed clock test 138Add 5 milliseconds to a high_resolution_clock::time_point 139Subtracting system_clock::time_point from monotonic_clock::time_point doesn't compile 140subtract high_resolution_clock::time_point from monotonic_clock::time_point and add that to a system_clock::time_point 141subtract two system_clock::time_point's and output that in microseconds: 1425000 microseconds 143timeval_demo system clock test 144sizeof xtime_clock::time_point = 8 145sizeof xtime_clock::duration = 8 146sizeof xtime_clock::rep = 8 147paused 5001000 nanoseconds 148runtime_resolution test 149paused 5000205 nanoseconds 150C map test 151It is now 10:47:13 2008-4-22 152Round-tripping through the C interface truncated the precision by 255445 microseconds 1532160000 1540 1553600000 1560 1572999998997 * 1/1000000000 seconds 1580 * 1/1000000000 seconds 15915778476000000000 microseconds 160paused 5001000 nanoseconds 161********* milliseconds(3) * 2.5 ********* 162The period of milliseconds(3) * 2.5 is 0.001 seconds. 163The frequency of milliseconds(3) * 2.5 is 1000 Hz. 164The representation is floating point 165The precision is the most significant 15 decimal digits. 166The range is +/- 5.69666e+297 years. 167sizeof(milliseconds(3) * 2.5) = 8 1687.5 169milliseconds ms(3.5) doesn't compile 170 171Simulated 400MHz clock which has a tick period of 2.5 nanoseconds 172delay = 500 nanoseconds which is 200 cycles 173paused 201 cycles which is 502 nanoseconds 174 175Simulated 400MHz clock modeled with nanoseconds 176delay = 500 nanoseconds 177paused 503 nanoseconds 178 179Simulated 1500MHz clock which has a tick period of 0.666667 nanoseconds 180delay = 500 nanoseconds which is 750 cycles 181paused 751 cycles which is 500 nanoseconds 182 183Simulated 1500MHz clock modeled with nanoseconds 184delay = 500 nanoseconds 185paused 500 nanoseconds 186duration<unsigned>::min().count() = 0 187duration<unsigned>::zero().count() = 0 188duration<unsigned>::max().count() = 4294967295 189duration<int>::min().count() = -2147483647 190duration<int>::zero().count() = 0 191duration<int>::max().count() = 2147483647 192