From: Zhao Liu Date: Mon, 14 Apr 2025 14:49:39 +0000 (+0800) Subject: rust/timer: Define NANOSECONDS_PER_SECOND binding as u64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d9502b4e947a9cfcf1d1940cc70d1579b53ecaf;p=thirdparty%2Fqemu.git rust/timer: Define NANOSECONDS_PER_SECOND binding as u64 NANOSECONDS_PER_SECOND is often used in operations with get_ns(), which currently returns a u64. Therefore, define a new NANOSECONDS_PER_SECOND binding is with u64 type to eliminate unnecessary type conversions (from u32 to u64). Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250414144943.1112885-6-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- diff --git a/rust/qemu-api/src/timer.rs b/rust/qemu-api/src/timer.rs index f0b04ef95d..e769f8bc91 100644 --- a/rust/qemu-api/src/timer.rs +++ b/rust/qemu-api/src/timer.rs @@ -121,3 +121,5 @@ impl ClockType { pub const CLOCK_VIRTUAL: ClockType = ClockType { id: QEMUClockType::QEMU_CLOCK_VIRTUAL, }; + +pub const NANOSECONDS_PER_SECOND: u64 = 1000000000;