about summary refs log tree commit diff
path: root/src/test/ui/thinlto
diff options
context:
space:
mode:
authorAlex Berghage <bearcage@ludumipsum.com>2019-01-06 11:53:47 -0700
committerAlex Berghage <aberghage@gmail.com>2019-01-22 19:18:28 -0700
commit55dea0edecc71a88ca11adb0629c0434e5d0f14b (patch)
treed38c68ea3deb83b83e1d092d0bf9e3d37908dedd /src/test/ui/thinlto
parent6bba352cad2117f56353d400f71e96eafa2e6bd7 (diff)
downloadrust-55dea0edecc71a88ca11adb0629c0434e5d0f14b.tar.gz
rust-55dea0edecc71a88ca11adb0629c0434e5d0f14b.zip
Simplify units in Duration/Instant math on Windows
Right now we do unit conversions between PerfCounter measurements
and nanoseconds for every add/sub we do between Durations and Instants
on Windows machines. This leads to goofy behavior, like this snippet
failing:

```
let now = Instant::now();
let offset = Duration::from_millis(5);
assert_eq!((now + offset) - now, (now - now) + offset);
```

with precision problems like this:

```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `4.999914ms`,
 right: `5ms`', src\main.rs:6:5
```

To fix it, this changeset does the unit conversion once, when we
measure the clock, and all the subsequent math in u64 nanoseconds.

It also adds an exact associativity test to the `sys/time.rs`
test suite to make sure we don't regress on this in the future.
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions