Skip to content

Add now feature flag #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ web-time = { version = "1.1.0", optional = true }
[features]
log = ["dep:log"]
experimental = ["tzdb"]
now = ["std", "dep:web-time"]
tzdb = ["dep:tzif", "std", "dep:jiff-tzdb", "dep:combine"]
std = []
4 changes: 2 additions & 2 deletions src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ mod time;
mod year_month;
mod zoneddatetime;

#[cfg(feature = "std")]
#[cfg(feature = "now")]
mod now;

#[cfg(feature = "std")]
#[cfg(feature = "now")]
#[doc(inline)]
pub use now::Now;

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub mod primitive;
pub(crate) mod components;
pub(crate) mod iso;

#[cfg(feature = "std")]
#[cfg(feature = "now")]
mod sys;

#[cfg(feature = "tzdb")]
Expand Down
1 change: 1 addition & 0 deletions src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use web_time::{SystemTime, UNIX_EPOCH};
// TODO: Need to implement SystemTime handling for non_std.

/// Returns the system time in nanoseconds.
#[cfg(feature = "now")]
pub(crate) fn get_system_nanoseconds() -> TemporalResult<u128> {
SystemTime::now()
.duration_since(UNIX_EPOCH)
Expand Down
Loading