Skip to main content

platform_rs/
timer.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#![no_std]
6
7unsafe extern "C" {
8    fn rust_timer_current_mono_ticks() -> i64;
9    fn rust_timer_current_boot_ticks() -> i64;
10}
11
12/// Returns the current monotonic time in ticks.
13#[inline]
14pub fn timer_current_mono_ticks() -> i64 {
15    unsafe { rust_timer_current_mono_ticks() }
16}
17
18/// Returns the current boot time in ticks.
19#[inline]
20pub fn timer_current_boot_ticks() -> i64 {
21    unsafe { rust_timer_current_boot_ticks() }
22}