Skip to content

Commit cab1bed

Browse files
author
Fred
committed
fix mistake in documents
1 parent b702c2f commit cab1bed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/chrono.qbk

+3-3
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ You can use __duration_cast`<>` to convert the __duration into whatever units yo
775775

776776
// d now holds the number of milliseconds from start to end.
777777

778-
std::cout << ms.count() << "ms\n";
778+
std::cout << d.count() << "ms\n";
779779

780780
We can convert to __nanoseconds, or some integral-based duration which __nanoseconds will always exactly convert to, then __duration_cast`<>` is unnecessary:
781781

@@ -808,7 +808,7 @@ If you need to use __duration_cast`<>`, but want to round up, instead of down wh
808808
typedef boost::chrono::__milliseconds ms;
809809
ms d = round_up<ms>(end - start);
810810
// d now holds the number of milliseconds from start to end, rounded up.
811-
std::cout << ms.count() << "ms\n";
811+
std::cout << d.count() << "ms\n";
812812

813813
[endsect]
814814

@@ -1199,7 +1199,7 @@ You can use __thread_clock whenever you want to measure the time spent by the cu
11991199
typedef boost::chrono::__milliseconds ms;
12001200
ms d = boost::chrono::__thread_clock::now() - start;
12011201
// d now holds the number of milliseconds from start to end.
1202-
std::cout << ms.count() << "ms\n";
1202+
std::cout << d.count() << "ms\n";
12031203

12041204
If you need seconds with a floating-point representation you can do:
12051205

0 commit comments

Comments
 (0)