@@ -16,9 +16,6 @@ use crate::base::TCFType;
1616use crate :: date:: { CFDate , CFTimeInterval } ;
1717use crate :: string:: CFString ;
1818
19- #[ cfg( feature ="with-chrono" ) ]
20- use chrono:: { FixedOffset , NaiveDateTime } ;
21-
2219declare_TCFType ! {
2320/// A time zone.
2421CFTimeZone , CFTimeZoneRef
@@ -56,17 +53,6 @@ impl CFTimeZone {
5653unsafe { CFTimeZoneGetSecondsFromGMT ( self . 0 , date. abs_time ( ) ) }
5754}
5855
59- #[ cfg( feature ="with-chrono" ) ]
60- pub fn offset_at_date ( & self , date : NaiveDateTime ) ->FixedOffset {
61- let date =CFDate :: from_naive_utc ( date) ;
62- FixedOffset :: east ( self . seconds_from_gmt ( date) as i32 )
63- }
64-
65- #[ cfg( feature ="with-chrono" ) ]
66- pub fn from_offset ( offset : FixedOffset ) ->CFTimeZone {
67- CFTimeZone :: new ( offset. local_minus_utc ( ) as f64 )
68- }
69-
7056/// The timezone database ID that identifies the time zone. E.g. `"America/Los_Angeles" `or
7157/// `"Europe/Paris"`.
7258pub fn name ( & self ) ->CFString {
@@ -78,22 +64,10 @@ impl CFTimeZone {
7864mod test{
7965use super :: CFTimeZone ;
8066
81- #[ cfg( feature ="with-chrono" ) ]
82- use chrono:: { FixedOffset , NaiveDateTime } ;
83-
8467#[ test]
8568fn timezone_comparison ( ) {
8669let system =CFTimeZone :: system ( ) ;
8770let default =CFTimeZone :: default ( ) ;
8871assert_eq ! ( system, default ) ;
8972}
90-
91- #[ test]
92- #[ cfg( feature ="with-chrono" ) ]
93- fn timezone_chrono_conversion ( ) {
94- let offset =FixedOffset :: west ( 28800 ) ;
95- let tz =CFTimeZone :: from_offset ( offset) ;
96- let converted = tz. offset_at_date ( NaiveDateTime :: from_timestamp ( 0 , 0 ) ) ;
97- assert_eq ! ( offset, converted) ;
98- }
9973}