Skip to content

rust: time: Add clock read support

Boqun Feng lkml rust-for-linux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5rust: time: doc: Add missing C header link to jiffiesrust/kernel/time.rs+2 -01 reply
2/5rust: time: Introduce Duration typerust/kernel/time.rs+44 -04 replies
3/5rust: time: Introduce clock reading frameworkrust/kernel/time.rs+49 -04 replies
4/5rust: time: Support reading CLOCK_MONOTONICrust/kernel/time.rs+19 -02 replies
5/5rust: time: Add Instant::elapsed() for monotonic clocksrust/kernel/time.rs+25 -05 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchBenno Lossin
1/5R-b
2/5
3/5
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] rust: time: Add clock read support

Hi Thomas,

This is an updated version of:

https://lore.kernel.org/rust-for-linux/Zf2kio8NYG5DEgyY@tardis/

where I'm trying to provide the same functionality of Alice's patch:

	https://lore.kernel.org/rust-for-linux/[email protected]/

along with the lesson we learned from the previous discussion:

	https://lore.kernel.org/rust-for-linux/[email protected]/
	https://lore.kernel.org/rust-for-linux/[email protected]/

There are three important types or traits (the design was mostly brought from previous patches):

* Instant type: it's a generic type for timestamps, whose backend is just ktime_t, but it has a generic type to differentiate clocks.

* Clock trait: to read a clock, one must implement the now function, in this series, only CLOCK_MONOTONIC support is added.

* Duration type: it's a signed 64 bit value which represents the timedelta, I've considered making it unsigned, but I want the following code:

  	d = ts2 - ts1;
	ts = ts3 + d;

to work even when ts2 < ts1, but I'm also OK to define it as an unsigned.

Let me know how you think about this.

Regards,
Boqun

Alice Ryhl (1):
rust: time: Introduce Duration type

Boqun Feng (4):
rust: time: doc: Add missing C header link to jiffies
rust: time: Introduce clock reading framework
rust: time: Support reading CLOCK_MONOTONIC
rust: time: Add Instant::elapsed() for monotonic clocks

 rust/kernel/time.rs | 139 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
Signature · 1 line
2.44.0