Comments (2)
The data is not needed for the library to work correctly. E.g. this code works fine:
use tzdb::time_zone::america::NEW_YORK;
fn main() {
let system = tz::TimeZone::from_posix_tz("America/New_York").unwrap();
let system = system.as_ref();
for transition in system.transitions() {
let date1 = tz::DateTime::from_timespec(
transition.unix_leap_time(),
0,
system,
).unwrap();
let date2 = tz::DateTime::from_timespec(
transition.unix_leap_time(),
0,
NEW_YORK,
).unwrap();
assert_eq!(date1, date2);
let date1 = tz::DateTime::from_timespec(
transition.unix_leap_time() + 1,
0,
system,
).unwrap();
let date2 = tz::DateTime::from_timespec(
transition.unix_leap_time() + 1,
0,
NEW_YORK,
).unwrap();
assert_eq!(date1, date2);
let date1 = tz::DateTime::from_timespec(
transition.unix_leap_time() - 1,
0,
system,
).unwrap();
let date2 = tz::DateTime::from_timespec(
transition.unix_leap_time() - 1,
0,
NEW_YORK,
).unwrap();
assert_eq!(date1, date2);
}
}
I don't know why the data is contained on average Linux systems, on my Debian machine, too.
I guess you have to work with ↓ to tell when further transition happen:
NEW_YORK.extra_rule().unwrap() = Alternate(
AlternateTime {
std: LocalTimeType {
ut_offset: -18000,
is_dst: false,
time_zone_designation: Some(
"EST",
),
},
dst: LocalTimeType {
ut_offset: -14400,
is_dst: true,
time_zone_designation: Some(
"EDT",
),
},
dst_start: MonthWeekDay(
MonthWeekDay {
month: 3,
week: 2,
week_day: 0,
},
),
dst_start_time: 7200,
dst_end: MonthWeekDay(
MonthWeekDay {
month: 11,
week: 1,
week_day: 0,
},
),
dst_end_time: 7200,
},
)
from tzdb.
Ah, ok I think .extra_rule()
might be what I need to incorporate for my use case. I had noticed the discrepancy with my Linux system and wanted to make sure I wasn't missing something. I appreciate the thoughtful response.
from tzdb.
Related Issues (12)
- Don't generate time zones with leap seconds by default HOT 1
- tzdb::local_tz() function get None in linux, expect get Some value . HOT 4
- tzdb::local_tz() function get None ,existing problems tzdb 0.4.1 version HOT 4
- Use a git submodule instead of squashing commits HOT 3
- RUSTSEC-2021-0127: serde_cbor is unmaintained HOT 1
- Optional `now` module in 0.5.x HOT 3
- Missing tag & changelog for 0.4.8 HOT 2
- Make `iana-time-zone` dep and `local_tz` function optional HOT 4
- Get Current Time Zone Name HOT 2
- Error for zones with underscore like Asia/Ho_Chi_Minh HOT 2
- Does tzdb support no_std? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tzdb.