Skip to content

Commit

Permalink
extract timing-utils crate (#3327)
Browse files Browse the repository at this point in the history
* extract timing-utils crate

* missing dev dep

* sort deps

* typo

* remove solana-logger dep

* rename to solana-time-utils

* update time-utils version
  • Loading branch information
kevinheavey authored Oct 29, 2024
1 parent 1cde3d5 commit e9616d0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ members = [
"sdk/slot-history",
"sdk/stable-layout",
"sdk/sysvar-id",
"sdk/time-utils",
"sdk/transaction-error",
"send-transaction-service",
"short-vec",
Expand Down Expand Up @@ -483,6 +484,7 @@ solana-sha256-hasher = { path = "sdk/sha256-hasher", version = "=2.2.0" }
solana-signature = { path = "sdk/signature", version = "=2.2.0", default-features = false }
solana-slot-hashes = { path = "sdk/slot-hashes", version = "=2.2.0" }
solana-slot-history = { path = "sdk/slot-history", version = "=2.2.0" }
solana-time-utils = { path = "sdk/time-utils", version = "=2.2.0" }
solana-timings = { path = "timings", version = "=2.2.0" }
solana-unified-scheduler-logic = { path = "unified-scheduler-logic", version = "=2.2.0" }
solana-unified-scheduler-pool = { path = "unified-scheduler-pool", version = "=2.2.0" }
Expand Down
5 changes: 5 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ solana-signature = { workspace = true, features = [
"std",
"verify",
], optional = true }
solana-time-utils = { workspace = true }
solana-transaction-error = { workspace = true, features = ["serde"], optional = true }
thiserror = { workspace = true }

Expand Down
3 changes: 2 additions & 1 deletion sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ pub mod signature;
pub mod signer;
pub mod simple_vote_transaction_checker;
pub mod system_transaction;
pub mod timing;
pub mod transaction;
pub mod transaction_context;
pub mod transport;
Expand Down Expand Up @@ -175,6 +174,8 @@ pub use solana_secp256k1_recover as secp256k1_recover;
pub use solana_serde_varint as serde_varint;
#[deprecated(since = "2.1.0", note = "Use `solana-short-vec` crate instead")]
pub use solana_short_vec as short_vec;
#[deprecated(since = "2.2.0", note = "Use `solana-time-utils` crate instead")]
pub use solana_time_utils as timing;

/// Convenience macro for `AddAssign` with saturating arithmetic.
/// Replace by `std::num::Saturating` once stable
Expand Down
16 changes: 16 additions & 0 deletions sdk/time-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "solana-time-utils"
description = "`std::time` utilities for Solana"
documentation = "https://docs.rs/solana-time-utils"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[lints]
workspace = true
3 changes: 1 addition & 2 deletions sdk/src/timing.rs → sdk/time-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The `timing` module provides std::time utility functions.
//! `std::time` utility functions.
use std::{
sync::atomic::{AtomicU64, Ordering},
time::{Duration, SystemTime, UNIX_EPOCH},
Expand Down Expand Up @@ -103,7 +103,6 @@ mod test {

#[test]
fn test_interval_update() {
solana_logger::setup();
let i = AtomicInterval::default();
assert!(!i.should_update(1000));

Expand Down

0 comments on commit e9616d0

Please sign in to comment.