diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-11-16 17:36:14 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-11-19 09:32:38 -0800 |
| commit | c6eb8527e09bed702f30ffdc8d6e54acf9b867ca (patch) | |
| tree | d3892a612ffcc125881ae8e4ff04c98ddcd5df49 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 22e31f10c22112b486f4999f90e4ba9c7e23b9b6 (diff) | |
| download | rust-c6eb8527e09bed702f30ffdc8d6e54acf9b867ca.tar.gz rust-c6eb8527e09bed702f30ffdc8d6e54acf9b867ca.zip | |
std: Add Instant and SystemTime to std::time
This commit is an implementation of [RFC 1288][rfc] which adds two new unstable types to the `std::time` module. The `Instant` type is used to represent measurements of a monotonically increasing clock suitable for measuring time withing a process for operations such as benchmarks or just the elapsed time to do something. An `Instant` favors panicking when bugs are found as the bugs are programmer errors rather than typical errors that can be encountered. [rfc]: https://github.com/rust-lang/rfcs/pull/1288 The `SystemTime` type is used to represent a system timestamp and is not monotonic. Very few guarantees are provided about this measurement of the system clock, but a fixed point in time (`UNIX_EPOCH`) is provided to learn about the relative distance from this point for any particular time stamp. This PR takes the same implementation strategy as the `time` crate on crates.io, namely: | Platform | Instant | SystemTime | |------------|--------------------------|--------------------------| | Windows | QueryPerformanceCounter | GetSystemTimeAsFileTime | | OSX | mach_absolute_time | gettimeofday | | Unix | CLOCK_MONOTONIC | CLOCK_REALTIME | These implementations can perhaps be refined over time, but they currently satisfy the requirements of the `Instant` and `SystemTime` types while also being portable across implementations and revisions of each platform.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
