# Use \`Duration\` to improve type safety and unit correctness \(\#62969\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5b70f793d3ab530515644e05caad2bc85c7cf6a5)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5b70f793d3ab530515644e05caad2bc85c7cf6a5

Requested commit: 5b70f793d3ab530515644e05caad2bc85c7cf6a5

Commit: 5b70f793d3ab530515644e05caad2bc85c7cf6a5

Tree: d7734a35d800a67e91ed2dee644ff172f9ba6f62

Author: tidely

Committer: GitHub

## Message

```
Use `Duration` to improve type safety and unit correctness (#62969)

# Objective

- Prefer using `Duration` instead of integers when dealing with spans of
time. This prevents confusing different units of time and comparing
arbitrary integers with durations.
- Remove `_ms`/`_secs` suffixes from variables which are `Duration`,
since their unit is inside of the type.
- Initialize large integer constants using `Duration`, which has more
descriptive constructors, while maintaining the resulting integer type.

Release Notes:

- N/A or Added/Fixed/Improved ...
```

## Parents

- [84aaa525952593739560d173ed22f35cdc38067c](https://git.cafe/gitcafe/zed/commit/84aaa525952593739560d173ed22f35cdc38067c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5b70f793d3ab530515644e05caad2bc85c7cf6a5?format=markdown)
