@@ -257,7 +257,7 @@ pub struct Tm {
257
257
/// Identifies the time zone that was used to compute this broken-down time value, including any
258
258
/// adjustment for Daylight Saving Time. This is the number of seconds east of UTC. For example,
259
259
/// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
260
- pub tm_gmtoff : i32 ,
260
+ pub tm_utcoff : i32 ,
261
261
262
262
/// Nanoseconds after the second - [0, 10<sup>9</sup> - 1]
263
263
pub tm_nsec : i32 ,
@@ -274,7 +274,7 @@ pub fn empty_tm() -> Tm {
274
274
tm_wday : 0_i32 ,
275
275
tm_yday : 0_i32 ,
276
276
tm_isdst : 0_i32 ,
277
- tm_gmtoff : 0_i32 ,
277
+ tm_utcoff : 0_i32 ,
278
278
tm_nsec : 0_i32 ,
279
279
}
280
280
}
@@ -313,7 +313,7 @@ impl Tm {
313
313
/// Convert time to the seconds from January 1, 1970
314
314
pub fn to_timespec ( & self ) -> Timespec {
315
315
unsafe {
316
- let sec = match self . tm_gmtoff {
316
+ let sec = match self . tm_utcoff {
317
317
0_i32 => rustrt:: rust_time_timegm ( self ) ,
318
318
_ => rustrt:: rust_time_mktime ( self )
319
319
} ;
@@ -373,7 +373,7 @@ impl Tm {
373
373
* utc: "Thu, 22 Mar 2012 14:53:18 GMT"
374
374
*/
375
375
pub fn rfc822 ( & self ) -> TmFmt {
376
- if self . tm_gmtoff == 0_i32 {
376
+ if self . tm_utcoff == 0_i32 {
377
377
TmFmt {
378
378
tm : self ,
379
379
format : FmtStr ( "%a, %d %b %Y %T GMT" ) ,
@@ -744,10 +744,10 @@ impl<'a> fmt::Show for TmFmt<'a> {
744
744
'w' => return ( tm. tm_wday as int ) . fmt ( fmt) ,
745
745
'Y' => return ( tm. tm_year as int + 1900 ) . fmt ( fmt) ,
746
746
'y' => return write ! ( fmt, "{:02d}" , ( tm. tm_year as int + 1900 ) % 100 ) ,
747
- 'Z' => if tm. tm_gmtoff == 0_i32 { "GMT " } else { "" } , // FIXME (#2350): support locale
747
+ 'Z' => if tm. tm_utcoff == 0_i32 { "UTC " } else { "" } , // FIXME (#2350): support locale
748
748
'z' => {
749
- let sign = if tm. tm_gmtoff > 0_i32 { '+' } else { '-' } ;
750
- let mut m = num:: abs ( tm. tm_gmtoff ) / 60_i32 ;
749
+ let sign = if tm. tm_utcoff > 0_i32 { '+' } else { '-' } ;
750
+ let mut m = num:: abs ( tm. tm_utcoff ) / 60_i32 ;
751
751
let h = m / 60_i32 ;
752
752
m -= h * 60_i32 ;
753
753
return write ! ( fmt, "{}{:02d}{:02d}" , sign, h, m) ;
@@ -778,7 +778,7 @@ impl<'a> fmt::Show for TmFmt<'a> {
778
778
self . tm . to_local ( ) . asctime ( ) . fmt ( fmt)
779
779
}
780
780
FmtRfc3339 => {
781
- if self . tm . tm_gmtoff == 0_i32 {
781
+ if self . tm . tm_utcoff == 0_i32 {
782
782
TmFmt {
783
783
tm : self . tm ,
784
784
format : FmtStr ( "%Y-%m-%dT%H:%M:%SZ" ) ,
@@ -788,8 +788,8 @@ impl<'a> fmt::Show for TmFmt<'a> {
788
788
tm : self . tm ,
789
789
format : FmtStr ( "%Y-%m-%dT%H:%M:%S" ) ,
790
790
} ;
791
- let sign = if self . tm . tm_gmtoff > 0_i32 { '+' } else { '-' } ;
792
- let mut m = num:: abs ( self . tm . tm_gmtoff ) / 60_i32 ;
791
+ let sign = if self . tm . tm_utcoff > 0_i32 { '+' } else { '-' } ;
792
+ let mut m = num:: abs ( self . tm . tm_utcoff ) / 60_i32 ;
793
793
let h = m / 60_i32 ;
794
794
m -= h * 60_i32 ;
795
795
write ! ( fmt, "{}{}{:02d}:{:02d}" , s, sign, h as int, m as int)
@@ -1150,7 +1150,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1150
1150
}
1151
1151
'Z' => {
1152
1152
if match_str ( s, pos, "UTC" ) || match_str ( s, pos, "GMT" ) {
1153
- tm. tm_gmtoff = 0_i32 ;
1153
+ tm. tm_utcoff = 0_i32 ;
1154
1154
Ok ( pos + 3 u)
1155
1155
} else {
1156
1156
// It's odd, but to maintain compatibility with c's
@@ -1174,7 +1174,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1174
1174
Some ( item) => {
1175
1175
let ( v, pos) = item;
1176
1176
if v == 0_i32 {
1177
- tm. tm_gmtoff = 0_i32 ;
1177
+ tm. tm_utcoff = 0_i32 ;
1178
1178
}
1179
1179
1180
1180
Ok ( pos)
@@ -1201,7 +1201,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1201
1201
tm_wday : 0_i32 ,
1202
1202
tm_yday : 0_i32 ,
1203
1203
tm_isdst : 0_i32 ,
1204
- tm_gmtoff : 0_i32 ,
1204
+ tm_utcoff : 0_i32 ,
1205
1205
tm_nsec : 0_i32 ,
1206
1206
} ;
1207
1207
let mut pos = 0 u;
@@ -1247,7 +1247,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1247
1247
tm_wday : tm. tm_wday ,
1248
1248
tm_yday : tm. tm_yday ,
1249
1249
tm_isdst : tm. tm_isdst ,
1250
- tm_gmtoff : tm. tm_gmtoff ,
1250
+ tm_utcoff : tm. tm_utcoff ,
1251
1251
tm_nsec : tm. tm_nsec ,
1252
1252
} )
1253
1253
} else { result }
@@ -1349,7 +1349,7 @@ mod tests {
1349
1349
assert_eq ! ( utc. tm_wday, 5_i32 ) ;
1350
1350
assert_eq ! ( utc. tm_yday, 43_i32 ) ;
1351
1351
assert_eq ! ( utc. tm_isdst, 0_i32 ) ;
1352
- assert_eq ! ( utc. tm_gmtoff , 0_i32 ) ;
1352
+ assert_eq ! ( utc. tm_utcoff , 0_i32 ) ;
1353
1353
assert_eq ! ( utc. tm_nsec, 54321_i32 ) ;
1354
1354
}
1355
1355
@@ -1370,7 +1370,7 @@ mod tests {
1370
1370
assert_eq ! ( local. tm_wday, 5_i32 ) ;
1371
1371
assert_eq ! ( local. tm_yday, 43_i32 ) ;
1372
1372
assert_eq ! ( local. tm_isdst, 0_i32 ) ;
1373
- assert_eq ! ( local. tm_gmtoff , -28800_i32 ) ;
1373
+ assert_eq ! ( local. tm_utcoff , -28800_i32 ) ;
1374
1374
assert_eq ! ( local. tm_nsec, 54321_i32 ) ;
1375
1375
}
1376
1376
@@ -1412,7 +1412,7 @@ mod tests {
1412
1412
assert ! ( tm. tm_year == 0_i32 ) ;
1413
1413
assert ! ( tm. tm_wday == 0_i32 ) ;
1414
1414
assert ! ( tm. tm_isdst == 0_i32 ) ;
1415
- assert ! ( tm. tm_gmtoff == 0_i32 ) ;
1415
+ assert ! ( tm. tm_utcoff == 0_i32 ) ;
1416
1416
assert ! ( tm. tm_nsec == 0_i32 ) ;
1417
1417
}
1418
1418
Err ( _) => ( )
@@ -1435,7 +1435,7 @@ mod tests {
1435
1435
assert ! ( tm. tm_wday == 5_i32 ) ;
1436
1436
assert ! ( tm. tm_yday == 0_i32 ) ;
1437
1437
assert ! ( tm. tm_isdst == 0_i32 ) ;
1438
- assert ! ( tm. tm_gmtoff == 0_i32 ) ;
1438
+ assert ! ( tm. tm_utcoff == 0_i32 ) ;
1439
1439
assert ! ( tm. tm_nsec == 12340000_i32 ) ;
1440
1440
}
1441
1441
}
@@ -1549,9 +1549,9 @@ mod tests {
1549
1549
assert ! ( test( "6" , "%w" ) ) ;
1550
1550
assert ! ( test( "2009" , "%Y" ) ) ;
1551
1551
assert ! ( test( "09" , "%y" ) ) ;
1552
- assert ! ( strptime( "-0000" , "%z" ) . unwrap( ) . tm_gmtoff ==
1552
+ assert ! ( strptime( "-0000" , "%z" ) . unwrap( ) . tm_utcoff ==
1553
1553
0 ) ;
1554
- assert ! ( strptime( "-0800" , "%z" ) . unwrap( ) . tm_gmtoff ==
1554
+ assert ! ( strptime( "-0800" , "%z" ) . unwrap( ) . tm_utcoff ==
1555
1555
0 ) ;
1556
1556
assert ! ( test( "%" , "%%" ) ) ;
1557
1557
0 commit comments