Crate shuteye [] [src]

nanosleep for rust

Goals

  • provide nanosleep for linux and macos

Future work

  • other OS support?

Usage

Include the module, create a timespec, call clock_nanosleep

Example

Sleep for 1 uS

use shuteye::*;

// create a timespec for the interval to sleep
let ts = Timespec::from_nano(1000).unwrap();
assert_eq!(ts.get_sec(), 0);
assert_eq!(ts.get_nsec(), 1000);

// call sleep
shuteye::sleep(ts);

Structs

Timespec

Functions

sleep

sleep for a relative time