baoyachi / shadow-rs

A build-time information stored in your rust project.(binary,lib,cdylib,dylib)
https://docs.rs/shadow-rs
MIT License
447 stars 41 forks source link

make `tzdb` an optional dependency #112

Closed davidkna closed 2 years ago

davidkna commented 2 years ago

This improves the minimum supported rust version a bit, and can be used in cases where having access to the local timezone is less important.

baoyachi commented 2 years ago

@davidkna Thx. It's cool

baoyachi commented 2 years ago

@davidkna I want tell you add tzdb crate context. I tried the method you provided before, but the run MacOS returned error, I found that tzdb solved this problem, so I used tzdb at present, the timeliness of TZDB will be more accurate.

So,I add some description in code .

+ // Warning: Attempt to create a new OffsetDateTime with the current date and time in the local offset. If the offset cannot be determined, an error is returned.
+// At present, using it on MacOS return error. Use it with careful.
+// Suggestion use feature tzdb crate exposed function at below.

https://github.com/baoyachi/shadow-rs/blob/1ce70bb64a56784178444479a526b8cbde040594/src/data_time.rs#L55-L57

I can open this function, but developers need to know this problem.