@@ -267,7 +267,7 @@ pub struct Tm {
267
267
/// Identifies the time zone that was used to compute this broken-down time value, including any
268
268
/// adjustment for Daylight Saving Time. This is the number of seconds east of UTC. For example,
269
269
/// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
270
- pub tm_gmtoff : i32 ,
270
+ pub tm_utcoff : i32 ,
271
271
272
272
/// Nanoseconds after the second - [0, 10<sup>9</sup> - 1]
273
273
pub tm_nsec : i32 ,
@@ -284,7 +284,7 @@ pub fn empty_tm() -> Tm {
284
284
tm_wday : 0_i32 ,
285
285
tm_yday : 0_i32 ,
286
286
tm_isdst : 0_i32 ,
287
- tm_gmtoff : 0_i32 ,
287
+ tm_utcoff : 0_i32 ,
288
288
tm_nsec : 0_i32 ,
289
289
}
290
290
}
@@ -323,7 +323,7 @@ impl Tm {
323
323
/// Convert time to the seconds from January 1, 1970
324
324
pub fn to_timespec ( & self ) -> Timespec {
325
325
unsafe {
326
- let sec = match self . tm_gmtoff {
326
+ let sec = match self . tm_utcoff {
327
327
0_i32 => rustrt:: rust_timegm ( self ) ,
328
328
_ => rustrt:: rust_mktime ( self )
329
329
} ;
@@ -383,7 +383,7 @@ impl Tm {
383
383
* utc: "Thu, 22 Mar 2012 14:53:18 GMT"
384
384
*/
385
385
pub fn rfc822 ( & self ) -> TmFmt {
386
- if self . tm_gmtoff == 0_i32 {
386
+ if self . tm_utcoff == 0_i32 {
387
387
TmFmt {
388
388
tm : self ,
389
389
format : FmtStr ( "%a, %d %b %Y %T GMT" ) ,
@@ -754,10 +754,10 @@ impl<'a> fmt::Show for TmFmt<'a> {
754
754
'w' => return ( tm. tm_wday as int ) . fmt ( fmt) ,
755
755
'Y' => return ( tm. tm_year as int + 1900 ) . fmt ( fmt) ,
756
756
'y' => return write ! ( fmt, "{:02d}" , ( tm. tm_year as int + 1900 ) % 100 ) ,
757
- 'Z' => if tm. tm_gmtoff == 0_i32 { "GMT " } else { "" } , // FIXME (#2350): support locale
757
+ 'Z' => if tm. tm_utcoff == 0_i32 { "UTC " } else { "" } , // FIXME (#2350): support locale
758
758
'z' => {
759
- let sign = if tm. tm_gmtoff > 0_i32 { '+' } else { '-' } ;
760
- let mut m = num:: abs ( tm. tm_gmtoff ) / 60_i32 ;
759
+ let sign = if tm. tm_utcoff > 0_i32 { '+' } else { '-' } ;
760
+ let mut m = num:: abs ( tm. tm_utcoff ) / 60_i32 ;
761
761
let h = m / 60_i32 ;
762
762
m -= h * 60_i32 ;
763
763
return write ! ( fmt, "{}{:02d}{:02d}" , sign, h, m) ;
@@ -788,7 +788,7 @@ impl<'a> fmt::Show for TmFmt<'a> {
788
788
self . tm . to_local ( ) . asctime ( ) . fmt ( fmt)
789
789
}
790
790
FmtRfc3339 => {
791
- if self . tm . tm_gmtoff == 0_i32 {
791
+ if self . tm . tm_utcoff == 0_i32 {
792
792
TmFmt {
793
793
tm : self . tm ,
794
794
format : FmtStr ( "%Y-%m-%dT%H:%M:%SZ" ) ,
@@ -798,8 +798,8 @@ impl<'a> fmt::Show for TmFmt<'a> {
798
798
tm : self . tm ,
799
799
format : FmtStr ( "%Y-%m-%dT%H:%M:%S" ) ,
800
800
} ;
801
- let sign = if self . tm . tm_gmtoff > 0_i32 { '+' } else { '-' } ;
802
- let mut m = num:: abs ( self . tm . tm_gmtoff ) / 60_i32 ;
801
+ let sign = if self . tm . tm_utcoff > 0_i32 { '+' } else { '-' } ;
802
+ let mut m = num:: abs ( self . tm . tm_utcoff ) / 60_i32 ;
803
803
let h = m / 60_i32 ;
804
804
m -= h * 60_i32 ;
805
805
write ! ( fmt, "{}{}{:02d}:{:02d}" , s, sign, h as int, m as int)
@@ -1160,7 +1160,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1160
1160
}
1161
1161
'Z' => {
1162
1162
if match_str ( s, pos, "UTC" ) || match_str ( s, pos, "GMT" ) {
1163
- tm. tm_gmtoff = 0_i32 ;
1163
+ tm. tm_utcoff = 0_i32 ;
1164
1164
Ok ( pos + 3 u)
1165
1165
} else {
1166
1166
// It's odd, but to maintain compatibility with c's
@@ -1184,7 +1184,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1184
1184
Some ( item) => {
1185
1185
let ( v, pos) = item;
1186
1186
if v == 0_i32 {
1187
- tm. tm_gmtoff = 0_i32 ;
1187
+ tm. tm_utcoff = 0_i32 ;
1188
1188
}
1189
1189
1190
1190
Ok ( pos)
@@ -1211,7 +1211,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1211
1211
tm_wday : 0_i32 ,
1212
1212
tm_yday : 0_i32 ,
1213
1213
tm_isdst : 0_i32 ,
1214
- tm_gmtoff : 0_i32 ,
1214
+ tm_utcoff : 0_i32 ,
1215
1215
tm_nsec : 0_i32 ,
1216
1216
} ;
1217
1217
let mut pos = 0 u;
@@ -1257,7 +1257,7 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, ParseError> {
1257
1257
tm_wday : tm. tm_wday ,
1258
1258
tm_yday : tm. tm_yday ,
1259
1259
tm_isdst : tm. tm_isdst ,
1260
- tm_gmtoff : tm. tm_gmtoff ,
1260
+ tm_utcoff : tm. tm_utcoff ,
1261
1261
tm_nsec : tm. tm_nsec ,
1262
1262
} )
1263
1263
} else { result }
@@ -1359,7 +1359,7 @@ mod tests {
1359
1359
assert_eq ! ( utc. tm_wday, 5_i32 ) ;
1360
1360
assert_eq ! ( utc. tm_yday, 43_i32 ) ;
1361
1361
assert_eq ! ( utc. tm_isdst, 0_i32 ) ;
1362
- assert_eq ! ( utc. tm_gmtoff , 0_i32 ) ;
1362
+ assert_eq ! ( utc. tm_utcoff , 0_i32 ) ;
1363
1363
assert_eq ! ( utc. tm_nsec, 54321_i32 ) ;
1364
1364
}
1365
1365
@@ -1380,7 +1380,7 @@ mod tests {
1380
1380
assert_eq ! ( local. tm_wday, 5_i32 ) ;
1381
1381
assert_eq ! ( local. tm_yday, 43_i32 ) ;
1382
1382
assert_eq ! ( local. tm_isdst, 0_i32 ) ;
1383
- assert_eq ! ( local. tm_gmtoff , -28800_i32 ) ;
1383
+ assert_eq ! ( local. tm_utcoff , -28800_i32 ) ;
1384
1384
assert_eq ! ( local. tm_nsec, 54321_i32 ) ;
1385
1385
}
1386
1386
@@ -1422,7 +1422,7 @@ mod tests {
1422
1422
assert ! ( tm. tm_year == 0_i32 ) ;
1423
1423
assert ! ( tm. tm_wday == 0_i32 ) ;
1424
1424
assert ! ( tm. tm_isdst == 0_i32 ) ;
1425
- assert ! ( tm. tm_gmtoff == 0_i32 ) ;
1425
+ assert ! ( tm. tm_utcoff == 0_i32 ) ;
1426
1426
assert ! ( tm. tm_nsec == 0_i32 ) ;
1427
1427
}
1428
1428
Err ( _) => ( )
@@ -1445,7 +1445,7 @@ mod tests {
1445
1445
assert ! ( tm. tm_wday == 5_i32 ) ;
1446
1446
assert ! ( tm. tm_yday == 0_i32 ) ;
1447
1447
assert ! ( tm. tm_isdst == 0_i32 ) ;
1448
- assert ! ( tm. tm_gmtoff == 0_i32 ) ;
1448
+ assert ! ( tm. tm_utcoff == 0_i32 ) ;
1449
1449
assert ! ( tm. tm_nsec == 12340000_i32 ) ;
1450
1450
}
1451
1451
}
@@ -1559,9 +1559,9 @@ mod tests {
1559
1559
assert ! ( test( "6" , "%w" ) ) ;
1560
1560
assert ! ( test( "2009" , "%Y" ) ) ;
1561
1561
assert ! ( test( "09" , "%y" ) ) ;
1562
- assert ! ( strptime( "-0000" , "%z" ) . unwrap( ) . tm_gmtoff ==
1562
+ assert ! ( strptime( "-0000" , "%z" ) . unwrap( ) . tm_utcoff ==
1563
1563
0 ) ;
1564
- assert ! ( strptime( "-0800" , "%z" ) . unwrap( ) . tm_gmtoff ==
1564
+ assert ! ( strptime( "-0800" , "%z" ) . unwrap( ) . tm_utcoff ==
1565
1565
0 ) ;
1566
1566
assert ! ( test( "%" , "%%" ) ) ;
1567
1567
0 commit comments