# test.scaled

- **Module:** test
- **Package:** libtmux
- **Language:** Rust
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/test.rs#L137
- **Page:** https://libtmux.org/en/rs/latest/reference/test-scaled/

```
test.scaled(base: Duration) -> Duration
```

Widen a fixture deadline by `LIBTMUX_TEST_TIMEOUT_SCALE`.

[`retry_until`] and the fixture's own deadlines already carry this. Reach
for it when a test states a deadline of its own -- waiting on something
this crate does not own, say -- so that it stretches on a loaded machine
like the ones around it rather than becoming the first to fire.

The scale never narrows a deadline: unset, unparseable, or below `1` all
leave `base` as it is.

## Example

```rust
use std::time::Duration;

use libtmux::test::scaled;

// Unset, the scale is 1 and a deadline is its own length.
assert!(scaled(Duration::from_secs(5)) >= Duration::from_secs(5));
```
