Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/zeitstempel/src/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  unix.rs

  Sprache: Rust
 

const NS_PER_S: u64 = 1_000_000_000;

fn timespec_to_ns(ts: libc::timespec) -> u64 {
    (ts.tv_sec as u64) * NS_PER_S + (ts.tv_nsec as u64)
}

/// The time from a clock that cannot be set
/// and represents monotonic time since some unspecified starting point,
/// that also includes any time that the system is suspended.
///
/// See [`clock_gettime`].
///
/// [`clock_gettime`]: https://manpages.debian.org/buster/manpages-dev/clock_gettime.3.en.html
pub fn now_including_suspend() -> u64 {
    let mut ts = libc::timespec {
        tv_sec: 0,
        tv_nsec: 0,
    };
    unsafe {
        libc::clock_gettime(libc::CLOCK_BOOTTIME, &mut ts);
    }

    timespec_to_ns(ts)
}

/// The time from a clock that cannot be set
/// and represents monotonic time since some unspecified starting point,
/// but that does not increment while the system is asleep.
///
/// See [`clock_gettime`] and [`FreeBSD clock_gettime`].
///
/// [`clock_gettime`]: https://manpages.debian.org/buster/manpages-dev/clock_gettime.3.en.html
/// [`FreeBSD clock_gettime`]: https://man.freebsd.org/cgi/man.cgi?query=clock_gettime&manpath=FreeBSD+15.0-RELEASE
pub fn now_awake() -> u64 {
    let mut ts = libc::timespec {
        tv_sec: 0,
        tv_nsec: 0,
    };
    #[cfg(any(target_os = "linux", target_os = "android"))]
    let clock = libc::CLOCK_MONOTONIC;
    #[cfg(target_os = "freebsd")]
    let clock = libc::CLOCK_UPTIME;
    unsafe {
        libc::clock_gettime(clock, &mut ts);
    }

    timespec_to_ns(ts)
}

Messung V0.5 in Prozent
C=53 H=83 G=69

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.