diff options
| author | Zhao Liu <zhao1.liu@intel.com> | 2025-04-14 22:49:39 +0800 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-05-02 17:37:46 +0200 |
| commit | 8d9502b4e947a9cfcf1d1940cc70d1579b53ecaf (patch) | |
| tree | 0a89a8c1667e9f4fb0b0eb3e19b4234785331062 /rust/qemu-api/src/timer.rs | |
| parent | cff1ec67509cacc2ea30d19ba61fa0ab0772e119 (diff) | |
| download | focaccia-qemu-8d9502b4e947a9cfcf1d1940cc70d1579b53ecaf.tar.gz focaccia-qemu-8d9502b4e947a9cfcf1d1940cc70d1579b53ecaf.zip | |
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 <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250414144943.1112885-6-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api/src/timer.rs')
| -rw-r--r-- | rust/qemu-api/src/timer.rs | 2 |
1 files changed, 2 insertions, 0 deletions
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; |