@@ -237,21 +237,11 @@ pub struct Tm {
237
237
/// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
238
238
pub tm_gmtoff : i32 ,
239
239
240
- /// Abbreviated name for the time zone that was used to compute this broken-down time value.
241
- /// For example, U.S. Pacific Daylight Time is "PDT".
242
- pub tm_zone : ~str ,
243
-
244
240
/// Nanoseconds after the second – [0, 10<sup>9</sup> - 1]
245
241
pub tm_nsec : i32 ,
246
242
}
247
243
248
244
pub fn empty_tm ( ) -> Tm {
249
- // 64 is the max size of the timezone buffer allocated on windows
250
- // in rust_localtime. In glibc the max timezone size is supposedly 3.
251
- let mut zone = StrBuf :: new ( ) ;
252
- for _ in range ( 0 , 64 ) {
253
- zone. push_char ( ' ' )
254
- }
255
245
Tm {
256
246
tm_sec : 0_i32 ,
257
247
tm_min : 0_i32 ,
@@ -263,7 +253,6 @@ pub fn empty_tm() -> Tm {
263
253
tm_yday : 0_i32 ,
264
254
tm_isdst : 0_i32 ,
265
255
tm_gmtoff : 0_i32 ,
266
- tm_zone : zone. into_owned ( ) ,
267
256
tm_nsec : 0_i32 ,
268
257
}
269
258
}
@@ -745,7 +734,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, StrBuf> {
745
734
'Z' => {
746
735
if match_str ( s, pos, "UTC" ) || match_str ( s, pos, "GMT" ) {
747
736
tm. tm_gmtoff = 0_i32 ;
748
- tm. tm_zone = "UTC" . to_owned ( ) ;
749
737
Ok ( pos + 3 u)
750
738
} else {
751
739
// It's odd, but to maintain compatibility with c's
@@ -770,7 +758,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, StrBuf> {
770
758
let ( v, pos) = item;
771
759
if v == 0_i32 {
772
760
tm. tm_gmtoff = 0_i32 ;
773
- tm. tm_zone = "UTC" . to_owned ( ) ;
774
761
}
775
762
776
763
Ok ( pos)
@@ -801,7 +788,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, StrBuf> {
801
788
tm_yday : 0_i32 ,
802
789
tm_isdst : 0_i32 ,
803
790
tm_gmtoff : 0_i32 ,
804
- tm_zone : "" . to_owned ( ) ,
805
791
tm_nsec : 0_i32 ,
806
792
} ;
807
793
let mut pos = 0 u;
@@ -848,7 +834,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, StrBuf> {
848
834
tm_yday : tm. tm_yday ,
849
835
tm_isdst : tm. tm_isdst ,
850
836
tm_gmtoff : tm. tm_gmtoff ,
851
- tm_zone : tm. tm_zone . clone ( ) ,
852
837
tm_nsec : tm. tm_nsec ,
853
838
} )
854
839
} else { result }
@@ -1050,7 +1035,7 @@ pub fn strftime(format: &str, tm: &Tm) -> StrBuf {
1050
1035
'w' => ( tm. tm_wday as int ) . to_str ( ) . to_strbuf ( ) ,
1051
1036
'Y' => ( tm. tm_year as int + 1900 ) . to_str ( ) . to_strbuf ( ) ,
1052
1037
'y' => format_strbuf ! ( "{:02d}" , ( tm. tm_year as int + 1900 ) % 100 ) ,
1053
- 'Z' => tm . tm_zone . to_strbuf ( ) ,
1038
+ 'Z' => "" . to_strbuf ( ) , // FIXME(pcwalton): Implement this.
1054
1039
'z' => {
1055
1040
let sign = if tm. tm_gmtoff > 0_i32 { '+' } else { '-' } ;
1056
1041
let mut m = num:: abs ( tm. tm_gmtoff ) / 60_i32 ;
@@ -1176,7 +1161,6 @@ mod tests {
1176
1161
assert_eq ! ( utc. tm_yday, 43_i32 ) ;
1177
1162
assert_eq ! ( utc. tm_isdst, 0_i32 ) ;
1178
1163
assert_eq ! ( utc. tm_gmtoff, 0_i32 ) ;
1179
- assert_eq ! ( utc. tm_zone, "UTC" . to_owned( ) ) ;
1180
1164
assert_eq ! ( utc. tm_nsec, 54321_i32 ) ;
1181
1165
}
1182
1166
@@ -1198,12 +1182,6 @@ mod tests {
1198
1182
assert_eq ! ( local. tm_yday, 43_i32 ) ;
1199
1183
assert_eq ! ( local. tm_isdst, 0_i32 ) ;
1200
1184
assert_eq ! ( local. tm_gmtoff, -28800_i32 ) ;
1201
-
1202
- // FIXME (#2350): We should probably standardize on the timezone
1203
- // abbreviation.
1204
- let zone = & local. tm_zone ;
1205
- assert ! ( * zone == "PST" . to_owned( ) || * zone == "Pacific Standard Time" . to_owned( ) ) ;
1206
-
1207
1185
assert_eq ! ( local. tm_nsec, 54321_i32 ) ;
1208
1186
}
1209
1187
@@ -1246,7 +1224,6 @@ mod tests {
1246
1224
assert ! ( tm. tm_wday == 0_i32 ) ;
1247
1225
assert ! ( tm. tm_isdst == 0_i32 ) ;
1248
1226
assert ! ( tm. tm_gmtoff == 0_i32 ) ;
1249
- assert ! ( tm. tm_zone == "" . to_owned( ) ) ;
1250
1227
assert ! ( tm. tm_nsec == 0_i32 ) ;
1251
1228
}
1252
1229
Err ( _) => ( )
@@ -1270,7 +1247,6 @@ mod tests {
1270
1247
assert ! ( tm. tm_yday == 0_i32 ) ;
1271
1248
assert ! ( tm. tm_isdst == 0_i32 ) ;
1272
1249
assert ! ( tm. tm_gmtoff == 0_i32 ) ;
1273
- assert ! ( tm. tm_zone == "" . to_owned( ) ) ;
1274
1250
assert ! ( tm. tm_nsec == 12340000_i32 ) ;
1275
1251
}
1276
1252
}
@@ -1382,10 +1358,6 @@ mod tests {
1382
1358
assert ! ( test( "6" , "%w" ) ) ;
1383
1359
assert ! ( test( "2009" , "%Y" ) ) ;
1384
1360
assert ! ( test( "09" , "%y" ) ) ;
1385
- assert ! ( strptime( "UTC" , "%Z" ) . unwrap( ) . tm_zone ==
1386
- "UTC" . to_owned( ) ) ;
1387
- assert ! ( strptime( "PST" , "%Z" ) . unwrap( ) . tm_zone ==
1388
- "" . to_owned( ) ) ;
1389
1361
assert ! ( strptime( "-0000" , "%z" ) . unwrap( ) . tm_gmtoff ==
1390
1362
0 ) ;
1391
1363
assert ! ( strptime( "-0800" , "%z" ) . unwrap( ) . tm_gmtoff ==
@@ -1457,12 +1429,6 @@ mod tests {
1457
1429
assert_eq ! ( local. strftime( "%Y" ) , "2009" . to_strbuf( ) ) ;
1458
1430
assert_eq ! ( local. strftime( "%y" ) , "09" . to_strbuf( ) ) ;
1459
1431
assert_eq ! ( local. strftime( "%+" ) , "2009-02-13T15:31:30-08:00" . to_strbuf( ) ) ;
1460
-
1461
- // FIXME (#2350): We should probably standardize on the timezone
1462
- // abbreviation.
1463
- let zone = local. strftime ( "%Z" ) ;
1464
- assert ! ( zone == "PST" . to_strbuf( ) || zone == "Pacific Standard Time" . to_strbuf( ) ) ;
1465
-
1466
1432
assert_eq ! ( local. strftime( "%z" ) , "-0800" . to_strbuf( ) ) ;
1467
1433
assert_eq ! ( local. strftime( "%%" ) , "%" . to_strbuf( ) ) ;
1468
1434
0 commit comments