about summary refs log tree commit diff
path: root/src/libtime
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-04-02 16:54:22 -0700
committerHuon Wilson <dbau.pp+github@gmail.com>2014-04-10 22:10:10 +1000
commitd8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260 (patch)
tree3ff220512aeae37710c8b1c783e1229e685bfce3 /src/libtime
parent7fbcb400f0697621ece9f9773b0f0bf1ec73e9c1 (diff)
downloadrust-d8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260.tar.gz
rust-d8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260.zip
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and
port all code over to use it.
Diffstat (limited to 'src/libtime')
-rw-r--r--src/libtime/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs
index 23ffb7813ba..d50ecc2a2ab 100644
--- a/src/libtime/lib.rs
+++ b/src/libtime/lib.rs
@@ -24,6 +24,7 @@ extern crate libc;
 
 use std::io::BufReader;
 use std::num;
+use std::strbuf::StrBuf;
 use std::str;
 
 static NSEC_PER_SEC: i32 = 1_000_000_000_i32;
@@ -236,7 +237,10 @@ pub struct Tm {
 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 zone = str::with_capacity(64);
+    let mut zone = StrBuf::new();
+    for _ in range(0, 64) {
+        zone.push_char(' ')
+    }
     Tm {
         tm_sec: 0_i32,
         tm_min: 0_i32,
@@ -248,7 +252,7 @@ pub fn empty_tm() -> Tm {
         tm_yday: 0_i32,
         tm_isdst: 0_i32,
         tm_gmtoff: 0_i32,
-        tm_zone: zone,
+        tm_zone: zone.into_owned(),
         tm_nsec: 0_i32,
     }
 }