Skip to content

Commit 1fd02ef

Browse files
authored
Add now feature flag (#123)
This PR adds now feature flag. It fixes a small import bug around the optional import of `web-time` with `sys.rs`.
1 parent a5d9815 commit 1fd02ef

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ web-time = { version = "1.1.0", optional = true }
4040
[features]
4141
log = ["dep:log"]
4242
experimental = ["tzdb"]
43+
now = ["std", "dep:web-time"]
4344
tzdb = ["dep:tzif", "std", "dep:jiff-tzdb", "dep:combine"]
4445
std = []

src/components/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ mod time;
1818
mod year_month;
1919
mod zoneddatetime;
2020

21-
#[cfg(feature = "std")]
21+
#[cfg(feature = "now")]
2222
mod now;
2323

24-
#[cfg(feature = "std")]
24+
#[cfg(feature = "now")]
2525
#[doc(inline)]
2626
pub use now::Now;
2727

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub mod primitive;
5454
pub(crate) mod components;
5555
pub(crate) mod iso;
5656

57-
#[cfg(feature = "std")]
57+
#[cfg(feature = "now")]
5858
mod sys;
5959

6060
#[cfg(feature = "tzdb")]

src/sys.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use web_time::{SystemTime, UNIX_EPOCH};
77
// TODO: Need to implement SystemTime handling for non_std.
88

99
/// Returns the system time in nanoseconds.
10+
#[cfg(feature = "now")]
1011
pub(crate) fn get_system_nanoseconds() -> TemporalResult<u128> {
1112
SystemTime::now()
1213
.duration_since(UNIX_EPOCH)

0 commit comments

Comments
 (0)