• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 use anyhow::Result;
6 
7 #[cfg(any(target_os = "linux", target_os = "android"))]
main() -> Result<()>8 fn main() -> Result<()> {
9     use readclock::ClockValues;
10     let clocks = ClockValues::now();
11     println!("{}", serde_json::to_string(&clocks)?);
12     Ok(())
13 }
14 
15 // Fallback main function to make the library's serialize / deserialize implementation usable on the
16 // e2etest side (which may not be Linux environment).
17 // This workaround is needed due to cargo's dependency limitations.
18 // c.f. https://github.com/rust-lang/cargo/issues/1982
19 #[cfg(not(any(target_os = "linux", target_os = "android")))]
main() -> Result<()>20 fn main() -> Result<()> {
21     unimplemented!("This architecture does not support reading CLOCK_MONOTONIC and CLOCK_BOOTTIME")
22 }
23