diff --git a/src/lib.rs b/src/lib.rs
index ba0711758..f27c31db1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -257,7 +257,7 @@ pub struct Tm {
/// Identifies the time zone that was used to compute this broken-down time value, including any
/// adjustment for Daylight Saving Time. This is the number of seconds east of UTC. For example,
/// for U.S. Pacific Daylight Time, the value is -7*60*60 = -25200.
- pub tm_gmtoff: i32,
+ pub tm_utcoff: i32,
/// Nanoseconds after the second - [0, 109 - 1]
pub tm_nsec: i32,
@@ -274,7 +274,7 @@ pub fn empty_tm() -> Tm {
tm_wday: 0_i32,
tm_yday: 0_i32,
tm_isdst: 0_i32,
- tm_gmtoff: 0_i32,
+ tm_utcoff: 0_i32,
tm_nsec: 0_i32,
}
}
@@ -313,7 +313,7 @@ impl Tm {
/// Convert time to the seconds from January 1, 1970
pub fn to_timespec(&self) -> Timespec {
unsafe {
- let sec = match self.tm_gmtoff {
+ let sec = match self.tm_utcoff {
0_i32 => rustrt::rust_time_timegm(self),
_ => rustrt::rust_time_mktime(self)
};
@@ -373,7 +373,7 @@ impl Tm {
* utc: "Thu, 22 Mar 2012 14:53:18 GMT"
*/
pub fn rfc822(&self) -> TmFmt {
- if self.tm_gmtoff == 0_i32 {
+ if self.tm_utcoff == 0_i32 {
TmFmt {
tm: self,
format: FmtStr("%a, %d %b %Y %T GMT"),
@@ -744,10 +744,10 @@ impl<'a> fmt::Show for TmFmt<'a> {
'w' => return (tm.tm_wday as int).fmt(fmt),
'Y' => return (tm.tm_year as int + 1900).fmt(fmt),
'y' => return write!(fmt, "{:02d}", (tm.tm_year as int + 1900) % 100),
- 'Z' => if tm.tm_gmtoff == 0_i32 { "GMT"} else { "" }, // FIXME (#2350): support locale
+ 'Z' => if tm.tm_utcoff == 0_i32 { "UTC"} else { "" }, // FIXME (#2350): support locale
'z' => {
- let sign = if tm.tm_gmtoff > 0_i32 { '+' } else { '-' };
- let mut m = num::abs(tm.tm_gmtoff) / 60_i32;
+ let sign = if tm.tm_utcoff > 0_i32 { '+' } else { '-' };
+ let mut m = num::abs(tm.tm_utcoff) / 60_i32;
let h = m / 60_i32;
m -= h * 60_i32;
return write!(fmt, "{}{:02d}{:02d}", sign, h, m);
@@ -778,7 +778,7 @@ impl<'a> fmt::Show for TmFmt<'a> {
self.tm.to_local().asctime().fmt(fmt)
}
FmtRfc3339 => {
- if self.tm.tm_gmtoff == 0_i32 {
+ if self.tm.tm_utcoff == 0_i32 {
TmFmt {
tm: self.tm,
format: FmtStr("%Y-%m-%dT%H:%M:%SZ"),
@@ -788,8 +788,8 @@ impl<'a> fmt::Show for TmFmt<'a> {
tm: self.tm,
format: FmtStr("%Y-%m-%dT%H:%M:%S"),
};
- let sign = if self.tm.tm_gmtoff > 0_i32 { '+' } else { '-' };
- let mut m = num::abs(self.tm.tm_gmtoff) / 60_i32;
+ let sign = if self.tm.tm_utcoff > 0_i32 { '+' } else { '-' };
+ let mut m = num::abs(self.tm.tm_utcoff) / 60_i32;
let h = m / 60_i32;
m -= h * 60_i32;
write!(fmt, "{}{}{:02d}:{:02d}", s, sign, h as int, m as int)
@@ -1150,7 +1150,7 @@ pub fn strptime(s: &str, format: &str) -> Result {
}
'Z' => {
if match_str(s, pos, "UTC") || match_str(s, pos, "GMT") {
- tm.tm_gmtoff = 0_i32;
+ tm.tm_utcoff = 0_i32;
Ok(pos + 3u)
} else {
// It's odd, but to maintain compatibility with c's
@@ -1174,7 +1174,7 @@ pub fn strptime(s: &str, format: &str) -> Result {
Some(item) => {
let (v, pos) = item;
if v == 0_i32 {
- tm.tm_gmtoff = 0_i32;
+ tm.tm_utcoff = 0_i32;
}
Ok(pos)
@@ -1201,7 +1201,7 @@ pub fn strptime(s: &str, format: &str) -> Result {
tm_wday: 0_i32,
tm_yday: 0_i32,
tm_isdst: 0_i32,
- tm_gmtoff: 0_i32,
+ tm_utcoff: 0_i32,
tm_nsec: 0_i32,
};
let mut pos = 0u;
@@ -1247,7 +1247,7 @@ pub fn strptime(s: &str, format: &str) -> Result {
tm_wday: tm.tm_wday,
tm_yday: tm.tm_yday,
tm_isdst: tm.tm_isdst,
- tm_gmtoff: tm.tm_gmtoff,
+ tm_utcoff: tm.tm_utcoff,
tm_nsec: tm.tm_nsec,
})
} else { result }
@@ -1349,7 +1349,7 @@ mod tests {
assert_eq!(utc.tm_wday, 5_i32);
assert_eq!(utc.tm_yday, 43_i32);
assert_eq!(utc.tm_isdst, 0_i32);
- assert_eq!(utc.tm_gmtoff, 0_i32);
+ assert_eq!(utc.tm_utcoff, 0_i32);
assert_eq!(utc.tm_nsec, 54321_i32);
}
@@ -1370,7 +1370,7 @@ mod tests {
assert_eq!(local.tm_wday, 5_i32);
assert_eq!(local.tm_yday, 43_i32);
assert_eq!(local.tm_isdst, 0_i32);
- assert_eq!(local.tm_gmtoff, -28800_i32);
+ assert_eq!(local.tm_utcoff, -28800_i32);
assert_eq!(local.tm_nsec, 54321_i32);
}
@@ -1412,7 +1412,7 @@ mod tests {
assert!(tm.tm_year == 0_i32);
assert!(tm.tm_wday == 0_i32);
assert!(tm.tm_isdst == 0_i32);
- assert!(tm.tm_gmtoff == 0_i32);
+ assert!(tm.tm_utcoff == 0_i32);
assert!(tm.tm_nsec == 0_i32);
}
Err(_) => ()
@@ -1435,7 +1435,7 @@ mod tests {
assert!(tm.tm_wday == 5_i32);
assert!(tm.tm_yday == 0_i32);
assert!(tm.tm_isdst == 0_i32);
- assert!(tm.tm_gmtoff == 0_i32);
+ assert!(tm.tm_utcoff == 0_i32);
assert!(tm.tm_nsec == 12340000_i32);
}
}
@@ -1549,9 +1549,9 @@ mod tests {
assert!(test("6", "%w"));
assert!(test("2009", "%Y"));
assert!(test("09", "%y"));
- assert!(strptime("-0000", "%z").unwrap().tm_gmtoff ==
+ assert!(strptime("-0000", "%z").unwrap().tm_utcoff ==
0);
- assert!(strptime("-0800", "%z").unwrap().tm_gmtoff ==
+ assert!(strptime("-0800", "%z").unwrap().tm_utcoff ==
0);
assert!(test("%", "%%"));
diff --git a/src/time_helpers.c b/src/time_helpers.c
index 162587b61..abeaace04 100644
--- a/src/time_helpers.c
+++ b/src/time_helpers.c
@@ -68,7 +68,7 @@ typedef struct {
int32_t tm_wday;
int32_t tm_yday;
int32_t tm_isdst;
- int32_t tm_gmtoff;
+ int32_t tm_utcoff;
int32_t tm_nsec;
} rust_time_tm;
@@ -87,7 +87,7 @@ static void rust_time_tm_to_tm(rust_time_tm* in_tm, struct tm* out_tm) {
static void tm_to_rust_tm(struct tm* in_tm,
rust_time_tm* out_tm,
- int32_t gmtoff,
+ int32_t utcoff,
int32_t nsec) {
out_tm->tm_sec = in_tm->tm_sec;
out_tm->tm_min = in_tm->tm_min;
@@ -98,7 +98,7 @@ static void tm_to_rust_tm(struct tm* in_tm,
out_tm->tm_wday = in_tm->tm_wday;
out_tm->tm_yday = in_tm->tm_yday;
out_tm->tm_isdst = in_tm->tm_isdst;
- out_tm->tm_gmtoff = gmtoff;
+ out_tm->tm_utcoff = utcoff;
out_tm->tm_nsec = nsec;
}
@@ -151,12 +151,12 @@ rust_time_localtime(int64_t sec, int32_t nsec, rust_time_tm *timeptr) {
LOCALTIME(&s, &tm);
#if defined(__WIN32__)
- int32_t gmtoff = -timezone;
+ int32_t utcoff = -timezone;
#else
- int32_t gmtoff = tm.tm_gmtoff;
+ int32_t utcoff = tm.tm_gmtoff;
#endif
- tm_to_rust_tm(&tm, timeptr, gmtoff, nsec);
+ tm_to_rust_tm(&tm, timeptr, utcoff, nsec);
}
int64_t