chrono-tz icon indicating copy to clipboard operation
chrono-tz copied to clipboard

GMTPlus* type error

Open hanyuwei70 opened this issue 7 years ago • 1 comments

When I use this code to process raw time string

match chrono::naive::NaiveDateTime::parse_from_str(&raw_timestring.trim(),&format{
    Err(e)=>(),                
    Ok(t)=>created_time=Some(GMTPlus1.from_local_datetime(&t).unwrap().with_timezone(&Utc))
}

I found that the GMTPlus1.from_local_datetime(&t).unwrap() is returning timezone -01. So am I misunderstanding doc or there's something wrong with your code?

hanyuwei70 avatar Jan 23 '18 07:01 hanyuwei70

For any future person baffled by this, the comment in the source data explains: https://github.com/eggert/tz/blob/ab21ad9710b88f28995b7ed47c6efda47ffb1be5/etcetera#L37-L43

In other words, it sounds like they're all flipped in sign from what you'd expect for POSIX compatibility.

jder avatar Mar 14 '21 01:03 jder