-
Notifications
You must be signed in to change notification settings - Fork 39
Chrono feature in built_time() example on docs.rs #57
Copy link
Copy link
Open
Description
An example function built_time() appears for the latest (0.6.1) version of built on docs.rs
#[cfg(feature = "chrono")]
fn built_time() -> built::chrono::DateTime<built::chrono::Local> {
built::util::strptime(built_info::BUILT_TIME_UTC)
.with_timezone(&built::chrono::offset::Local)
}
What is the proper way to enable the chrono feature to enable conditional compilation of built_time()? Maybe this cfg is no longer needed, because commenting it out includes the function. Note that that adding this to Cargo.toml has no effect.
[features]
chrono = []
The fix can be tested by adding built_time() before main() in built/example_project/src/main.rs and adding this to main():
println!("Build time: {:?}", built_time());
You should see that built_time() is not found when the cfg is present, and the build succeeds if it's commented out.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels