# RFE: SystemTime: Resolution?

**URL:** <https://internals.rust-lang.org/t/rfe-systemtime-resolution/19017>\
**Category:** internals\
**Created:** [June 17, 2023, 12:01pm UTC](https://internals.rust-lang.org/t/rfe-systemtime-resolution/19017 "2023-06-17T12:01:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![penguin42](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/penguin42/32/10977_2.png) [@penguin42](https://internals.rust-lang.org/u/penguin42)\
**Post date:** [June 17, 2023, 12:01pm UTC](https://internals.rust-lang.org/t/rfe-systemtime-resolution/19017/1 "2023-06-17T12:01:09Z")

</div>

Hi, If I understand correctly SystemTime on Linux uses clock\_gettime, it would be nice if it had a way to get the resolution of the clock it was using - in Linux's case this is given by clock\_getres

---

<div class="post-metadata">

**Author:** ![the8472](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@the8472](https://internals.rust-lang.org/u/the8472)\
**Post date:** [June 17, 2023, 9:11pm UTC](https://internals.rust-lang.org/t/rfe-systemtime-resolution/19017/2 "2023-06-17T21:11:22Z")

</div>

Imo before we add any more surface to std's time API it there needs a plan where we want to go, not just adding things piece by piece. E.g. people are also asking for `sleep_until`, but then which clock will be used for sleeping? So we might need a notion of `ClockSource` where a resolution method could make sense too.

There already are a bunch of warts and other open questions such

- should `Instant` should include or exclude suspend time
- can there be a ZERO or EPOCH for instants

---

<div class="post-metadata">

**Author:** ![penguin42](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/penguin42/32/10977_2.png) [@penguin42](https://internals.rust-lang.org/u/penguin42)\
**Post date:** [June 17, 2023, 9:33pm UTC](https://internals.rust-lang.org/t/rfe-systemtime-resolution/19017/3 "2023-06-17T21:33:11Z")

</div>

Yes, I agree - I'm not saying this needs to go in urgently; just that it's needed at some point - if that's when a ClockSource happens then that makes sense to me. Although the fact that the docs have to point out the resolution is system dependent without telling you what to do about it, is a good indication it's needed.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [September 15, 2023, 9:33pm UTC](https://internals.rust-lang.org/t/rfe-systemtime-resolution/19017/4 "2023-09-15T21:33:30Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
