Skip to content

Commit 91fb5ee

Browse files
mfreebornMichael Freeborn
andauthored
bring tokio-walltime in-house and fix the undefined behaviour (#78)
* bring tokio-walltime in-house and fix the undefined behaviour * lints --------- Co-authored-by: Michael Freeborn <michael@colinear-acoustics.co.uk>
1 parent 2be9bb9 commit 91fb5ee

File tree

6 files changed

+202
-57
lines changed

6 files changed

+202
-57
lines changed

Cargo.lock

Lines changed: 91 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ integration-test = []
1818

1919
[dependencies]
2020
chrono = "0.4"
21+
clap = { version = "3", features = ["derive"] }
2122
crossterm = "0.24.0"
2223
dirs = "4"
24+
errno = "0.3.12"
25+
libc = "0.2.172"
2326
serde = { version = "1", features = ["derive"] }
2427
serde_json = "1"
25-
clap = { version = "3", features = ["derive"] }
26-
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
27-
tokio-walltime = "0.1.2"
28+
tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal", "time"] }
2829
toml = "0.5"
2930

3031
[dev-dependencies]
@@ -34,5 +35,5 @@ pretty_assertions = "1"
3435

3536
[profile.release]
3637
codegen-units = 1
37-
lto = "fat"
38+
lto = true
3839
opt-level = 3

src/errors.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error;
22

3+
use crate::sleep;
34
use chrono::{self, DateTime, FixedOffset};
4-
use tokio_walltime;
55

66
#[derive(Debug)]
77
pub enum HeliocronError {
@@ -45,7 +45,7 @@ pub enum RuntimeErrorKind {
4545
NonOccurringEvent,
4646
PastEvent(DateTime<FixedOffset>),
4747
EventMissed(i64),
48-
SleepError(tokio_walltime::Error),
48+
SleepError(sleep::Error),
4949
}
5050

5151
impl std::fmt::Display for HeliocronError {
@@ -89,8 +89,8 @@ impl From<chrono::ParseError> for HeliocronError {
8989
}
9090
}
9191

92-
impl From<tokio_walltime::Error> for HeliocronError {
93-
fn from(err: tokio_walltime::Error) -> Self {
92+
impl From<sleep::Error> for HeliocronError {
93+
fn from(err: sleep::Error) -> Self {
9494
HeliocronError::Runtime(RuntimeErrorKind::SleepError(err))
9595
}
9696
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub mod cli;
33
pub mod domain;
44
pub mod errors;
55
pub mod report;
6+
mod sleep;
67
pub mod subcommands;
78
pub mod traits;
89
pub mod utils;

0 commit comments

Comments
 (0)