Skip to content

Commit 0d6e75f

Browse files
committed
polish elapsed time
1 parent eb085a8 commit 0d6e75f

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/03-01-elapsed-time.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Measure the elapsed time between two code sections
22

3-
Measures [`std.time.Instant.since`] since [`std.time.Instant.now`].
3+
[`Instant`] represents a timestamp with respect to the currently executing program that ticks during suspend and can be used to record elapsed time.
44

55
Calling [`std.time.Instant.since`] returns a u64 representing nanoseconds elapsed.
66

@@ -27,8 +27,5 @@ pub fn main() !void {
2727
}
2828
```
2929

30-
[`std.time.ns_per_s`]: https://ziglang.org/documentation/master/std/#A;std:time.ns_per_s
30+
[`Instant`]: https://ziglang.org/documentation/master/std/#A;std:time.Instant
3131
[`std.time.Instant.since`]: https://ziglang.org/documentation/master/std/#A;std:time.Instant.since
32-
[`std.time.Instant.now`]: https://ziglang.org/documentation/master/std/#A;std:time.Instant.now
33-
[`std.time.Instant`]:https://ziglang.org/documentation/master/std/#A;std:time.Instant
34-
Measure the elapsed time

src/intro.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55

66
[Zig cookbook](https://zigcc.github.io/zig-cookbook/) is a collection of simple Zig programs that demonstrate good practices to accomplish common programming tasks.
77

8-
# How to run
8+
# How to use
9+
10+
[The website](https://zigcc.github.io/zig-cookbook/) is generated by [mdbook](https://rust-lang.github.io/mdBook/), `mdbook serve` will start a server at `http://localhost:3000` for preview.
911

1012
Each recipe is accompanied by an illustrative example named after its corresponding sequence number. These examples can be executed using the command `zig build run-{chapter-num}-{sequence-num}`, or `zig build run-all` to execute all.
1113

1214
> Currently Zig 0.11.0 is required to run those examples.
1315
1416
# Contributing
1517

16-
This cookbook is a work in progress, and we welcome contributions from the community. If you have a favorite recipe that you'd like to share, please submit a pull request.
18+
This cookbook is a work in progress, and we welcome contributions from the community. If you have a favorite recipe that you'd like to share, please submit a [pull request](https://github.com/zigcc/zig-cookbook/pulls).
1719

1820
# Acknowledgment
1921

0 commit comments

Comments
 (0)