All Projects → DoumanAsh → async-timer

DoumanAsh / async-timer

Licence: BSL-1.0 License
Timer facilities for Rust's async story

Programming Languages

rust
11053 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to async-timer

bestest timer
This is an awesome punch clock/timer plugin for Redmine. It's great. It's the bestest.
Stars: ✭ 15 (-59.46%)
Mutual labels:  timer
timerlab
⏰ A simple and customizable timer
Stars: ✭ 94 (+154.05%)
Mutual labels:  timer
custom timer
A Flutter package to create a customizable timer.
Stars: ✭ 25 (-32.43%)
Mutual labels:  timer
LiveSplitOne
A version of LiveSplit that works on a lot of platforms.
Stars: ✭ 172 (+364.86%)
Mutual labels:  timer
tm
timers and timeline
Stars: ✭ 31 (-16.22%)
Mutual labels:  timer
libmcu
A toolkit for firmware development
Stars: ✭ 33 (-10.81%)
Mutual labels:  timer
timer-machine-android
⏲ A highly customizable interval timer app for Android
Stars: ✭ 32 (-13.51%)
Mutual labels:  timer
countdown-vuejs
A Countdown Timer component for Vue.js
Stars: ✭ 58 (+56.76%)
Mutual labels:  timer
gnome-shell-teatime
No description or website provided.
Stars: ✭ 34 (-8.11%)
Mutual labels:  timer
Aospdeskclock
Fork of aosp deskclock: alarm,clock, timer,stopwatch
Stars: ✭ 28 (-24.32%)
Mutual labels:  timer
pauseable.js
Create event emitters, intervals, and timeouts that can be paused and resumed.
Stars: ✭ 44 (+18.92%)
Mutual labels:  timer
flipdown-timer-card
Flipdown Timer Card for Home Assistant Lovelace
Stars: ✭ 28 (-24.32%)
Mutual labels:  timer
vue-circular-count-down-timer
a count down timer library for vue.js
Stars: ✭ 45 (+21.62%)
Mutual labels:  timer
alfred-timer-workflow
Alfred workflow to start a timer, which blinks when the time is up.
Stars: ✭ 39 (+5.41%)
Mutual labels:  timer
react-component-countdown-timer
This is a simple count down timer react component.
Stars: ✭ 18 (-51.35%)
Mutual labels:  timer
timezz
With this plugin, you can easily make a stopwatch or timer on your site. Just init, style and enjoy.
Stars: ✭ 35 (-5.41%)
Mutual labels:  timer
redtimer
RedTimer - Redmine Time Tracker
Stars: ✭ 59 (+59.46%)
Mutual labels:  timer
waves-timer-animation
A relaxing waves animation built with Jetpack Compose
Stars: ✭ 121 (+227.03%)
Mutual labels:  timer
goodtimer
Golang timer for humans.
Stars: ✭ 31 (-16.22%)
Mutual labels:  timer
advpl-MsgTimer
Função AdvPL de mensagens (Alert, Info, Stop, Success, YesNo e NoYes) com Timer para fechamento automático
Stars: ✭ 17 (-54.05%)
Mutual labels:  timer

async-timer

Rust Crates.io Documentation dependency status

Timer facilities for Rust's async story

Accuracy

Regular timers that do not rely on async event loop tend to be on par with user space timers like in tokio. If that's not suitable for you you should enable event loop based timers which in most cases give you the most accurate timers possible on unix platforms (See features.)

Features

  • tokio1 - Enables event loop based timers using tokio, providing higher resolution timers on unix platforms.
  • c_wrapper - Uses C shim to create bindings to platform API, which may be more reliable than libc.
  • std - Enables usage of std types (e.g. Error)
  • stream - Enables Stream implementation for Interval

Examples

Timed

async fn job() {
}

async fn do_job() {
    let work = unsafe {
        async_timer::Timed::platform_new_unchecked(job(), core::time::Duration::from_secs(1))
    };

    match work.await {
        Ok(_) => println!("I'm done!"),
        //You can retry by polling `expired`
        Err(expired) => println!("Job expired: {}", expired),
    }
}

Interval

async fn job() {
}

async fn do_a_while() {
    let mut times: u8 = 0;
    let mut interval = async_timer::Interval::platform_new(core::time::Duration::from_secs(1));

    while times < 5 {
        job().await;
        interval.wait().await;
        times += 1;
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].