about summary refs log tree commit diff
path: root/src/libtime
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-08-06 11:59:40 +0200
committerNick Cameron <ncameron@mozilla.com>2014-08-26 16:07:32 +1200
commit52ef46251ede1ff51e5d5621d5fe2614e950f963 (patch)
tree481371289f467bc89a6d6dc769635dac1d47a6cb /src/libtime
parent3e626375d8d2226a203bf6ea6e98dab14774c59f (diff)
downloadrust-52ef46251ede1ff51e5d5621d5fe2614e950f963.tar.gz
rust-52ef46251ede1ff51e5d5621d5fe2614e950f963.zip
Rebasing changes
Diffstat (limited to 'src/libtime')
-rw-r--r--src/libtime/lib.rs37
1 files changed, 5 insertions, 32 deletions
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs
index 9a56dd5c0e4..429a16ec5c8 100644
--- a/src/libtime/lib.rs
+++ b/src/libtime/lib.rs
@@ -1,4 +1,4 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -268,19 +268,7 @@ pub struct Tm {
     pub tm_nsec: i32,
 }
 
-impl Tm {
-    pub fn tm_zone<'a>(&'a self) -> &'a str {
-        self.tm_zone.as_slice()
-    }
-}
-
 pub fn empty_tm() -> Tm {
-    // 64 is the max size of the timezone buffer allocated on windows
-    // in rust_localtime. In glibc the max timezone size is supposedly 3.
-    let mut zone = StrBuf::new();
-    for _ in range(0, 64) {
-        zone.push_char(' ')
-    }
     Tm {
         tm_sec: 0_i32,
         tm_min: 0_i32,
@@ -292,7 +280,6 @@ pub fn empty_tm() -> Tm {
         tm_yday: 0_i32,
         tm_isdst: 0_i32,
         tm_gmtoff: 0_i32,
-        tm_zone: zone,
         tm_nsec: 0_i32,
     }
 }
@@ -773,7 +760,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, String> {
           'Z' => {
             if match_str(s, pos, "UTC") || match_str(s, pos, "GMT") {
                 tm.tm_gmtoff = 0_i32;
-                tm.tm_zone = "UTC".into_strbuf();
                 Ok(pos + 3u)
             } else {
                 // It's odd, but to maintain compatibility with c's
@@ -798,7 +784,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, String> {
                     let (v, pos) = item;
                     if v == 0_i32 {
                         tm.tm_gmtoff = 0_i32;
-                        tm.tm_zone = "UTC".into_strbuf();
                     }
 
                     Ok(pos)
@@ -828,7 +813,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, String> {
         tm_yday: 0_i32,
         tm_isdst: 0_i32,
         tm_gmtoff: 0_i32,
-        tm_zone: StrBuf::new(),
         tm_nsec: 0_i32,
     };
     let mut pos = 0u;
@@ -875,7 +859,6 @@ pub fn strptime(s: &str, format: &str) -> Result<Tm, String> {
             tm_yday: tm.tm_yday,
             tm_isdst: tm.tm_isdst,
             tm_gmtoff: tm.tm_gmtoff,
-            tm_zone: tm.tm_zone.clone(),
             tm_nsec: tm.tm_nsec,
         })
     } else { result }
@@ -1077,7 +1060,6 @@ pub fn strftime(format: &str, tm: &Tm) -> String {
           'w' => (tm.tm_wday as int).to_string(),
           'Y' => (tm.tm_year as int + 1900).to_string(),
           'y' => format!("{:02d}", (tm.tm_year as int + 1900) % 100),
-          'Z' => tm.tm_zone.as_slice().to_owned(),
           'z' => {
             let sign = if tm.tm_gmtoff > 0_i32 { '+' } else { '-' };
             let mut m = num::abs(tm.tm_gmtoff) / 60_i32;
@@ -1203,7 +1185,6 @@ mod tests {
         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_zone(), "UTC");
         assert_eq!(utc.tm_nsec, 54321_i32);
     }
 
@@ -1225,12 +1206,6 @@ mod tests {
         assert_eq!(local.tm_yday, 43_i32);
         assert_eq!(local.tm_isdst, 0_i32);
         assert_eq!(local.tm_gmtoff, -28800_i32);
-
-        // FIXME (#2350): We should probably standardize on the timezone
-        // abbreviation.
-        let zone = local.tm_zone();
-        assert!(zone == "PST" || zone == "Pacific Standard Time");
-
         assert_eq!(local.tm_nsec, 54321_i32);
     }
 
@@ -1273,7 +1248,6 @@ mod tests {
             assert!(tm.tm_wday == 0_i32);
             assert!(tm.tm_isdst == 0_i32);
             assert!(tm.tm_gmtoff == 0_i32);
-            assert!(tm.tm_zone() == "");
             assert!(tm.tm_nsec == 0_i32);
           }
           Err(_) => ()
@@ -1297,7 +1271,6 @@ mod tests {
             assert!(tm.tm_yday == 0_i32);
             assert!(tm.tm_isdst == 0_i32);
             assert!(tm.tm_gmtoff == 0_i32);
-            assert!(tm.tm_zone() == "");
             assert!(tm.tm_nsec == 12340000_i32);
           }
         }
@@ -1409,10 +1382,10 @@ mod tests {
         assert!(test("6", "%w"));
         assert!(test("2009", "%Y"));
         assert!(test("09", "%y"));
-        assert!(strptime("UTC", "%Z").unwrap().tm_zone() == "UTC");
-        assert!(strptime("PST", "%Z").unwrap().tm_zone() == "");
-        assert!(strptime("-0000", "%z").unwrap().tm_gmtoff == 0);
-        assert!(strptime("-0800", "%z").unwrap().tm_gmtoff == 0);
+        assert!(strptime("-0000", "%z").unwrap().tm_gmtoff ==
+            0);
+        assert!(strptime("-0800", "%z").unwrap().tm_gmtoff ==
+            0);
         assert!(test("%", "%%"));
 
         // Test for #7256