about summary refs log tree commit diff
path: root/src/libstd/time.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-29 16:09:41 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-29 16:09:50 -0700
commitee2ce036ccd53d8c19689d86cf8b3bd5cf37f40f (patch)
tree701e66b3c5e2d6c74d018a6234381434ebbf7842 /src/libstd/time.rs
parentaab4d6b8d73f029d178c3ac055152f57c7233995 (diff)
downloadrust-ee2ce036ccd53d8c19689d86cf8b3bd5cf37f40f.tar.gz
rust-ee2ce036ccd53d8c19689d86cf8b3bd5cf37f40f.zip
Camel case more std types
Diffstat (limited to 'src/libstd/time.rs')
-rw-r--r--src/libstd/time.rs54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index 174f92a3486..fec45cfc178 100644
--- a/src/libstd/time.rs
+++ b/src/libstd/time.rs
@@ -6,12 +6,12 @@ import io::Reader;
 import result::{Result, Ok, Err};
 
 export
-    timespec,
+    Timespec,
     get_time,
     precise_time_ns,
     precise_time_s,
     tzset,
-    tm,
+    Tm,
     empty_tm,
     now,
     at,
@@ -26,20 +26,20 @@ extern mod rustrt {
 
     fn rust_tzset();
     // FIXME: The i64 values can be passed by-val when #2064 is fixed.
-    fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: tm);
-    fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: tm);
-    fn rust_timegm(&&tm: tm, &sec: i64);
-    fn rust_mktime(&&tm: tm, &sec: i64);
+    fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: Tm);
+    fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: Tm);
+    fn rust_timegm(&&tm: Tm, &sec: i64);
+    fn rust_mktime(&&tm: Tm, &sec: i64);
 }
 
 /// A record specifying a time value in seconds and nanoseconds.
-type timespec = {sec: i64, nsec: i32};
+type Timespec = {sec: i64, nsec: i32};
 
 /**
  * Returns the current time as a `timespec` containing the seconds and
  * nanoseconds since 1970-01-01T00:00:00Z.
  */
-fn get_time() -> timespec {
+fn get_time() -> Timespec {
     let mut sec = 0i64;
     let mut nsec = 0i32;
     rustrt::get_time(sec, nsec);
@@ -68,7 +68,7 @@ fn tzset() {
     rustrt::rust_tzset();
 }
 
-type tm_ = {
+type Tm_ = {
     tm_sec: i32, // seconds after the minute ~[0-60]
     tm_min: i32, // minutes after the hour ~[0-59]
     tm_hour: i32, // hours after midnight ~[0-23]
@@ -83,12 +83,12 @@ type tm_ = {
     tm_nsec: i32, // nanoseconds
 };
 
-enum tm {
-    tm_(tm_)
+enum Tm {
+    Tm_(Tm_)
 }
 
-fn empty_tm() -> tm {
-    tm_({
+fn empty_tm() -> Tm {
+    Tm_({
         tm_sec: 0_i32,
         tm_min: 0_i32,
         tm_hour: 0_i32,
@@ -105,7 +105,7 @@ fn empty_tm() -> tm {
 }
 
 /// Returns the specified time in UTC
-fn at_utc(clock: timespec) -> tm {
+fn at_utc(clock: Timespec) -> Tm {
     let mut {sec, nsec} = clock;
     let mut tm = empty_tm();
     rustrt::rust_gmtime(sec, nsec, tm);
@@ -113,12 +113,12 @@ fn at_utc(clock: timespec) -> tm {
 }
 
 /// Returns the current time in UTC
-fn now_utc() -> tm {
+fn now_utc() -> Tm {
     at_utc(get_time())
 }
 
 /// Returns the specified time in the local timezone
-fn at(clock: timespec) -> tm {
+fn at(clock: Timespec) -> Tm {
     let mut {sec, nsec} = clock;
     let mut tm = empty_tm();
     rustrt::rust_localtime(sec, nsec, tm);
@@ -126,13 +126,13 @@ fn at(clock: timespec) -> tm {
 }
 
 /// Returns the current time in the local timezone
-fn now() -> tm {
+fn now() -> Tm {
     at(get_time())
 }
 
 /// Parses the time from the string according to the format string.
-fn strptime(s: &str, format: &str) -> Result<tm, ~str> {
-    type tm_mut = {
+fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
+    type TmMut = {
        mut tm_sec: i32,
        mut tm_min: i32,
        mut tm_hour: i32,
@@ -209,7 +209,7 @@ fn strptime(s: &str, format: &str) -> Result<tm, ~str> {
         }
     }
 
-    fn parse_type(s: &str, pos: uint, ch: char, tm: &tm_mut)
+    fn parse_type(s: &str, pos: uint, ch: char, tm: &TmMut)
       -> Result<uint, ~str> {
         match ch {
           'A' => match match_strs(s, pos, ~[
@@ -554,7 +554,7 @@ fn strptime(s: &str, format: &str) -> Result<tm, ~str> {
         }
 
         if pos == len && rdr.eof() {
-            Ok(tm_({
+            Ok(Tm_({
                 tm_sec: tm.tm_sec,
                 tm_min: tm.tm_min,
                 tm_hour: tm.tm_hour,
@@ -572,8 +572,8 @@ fn strptime(s: &str, format: &str) -> Result<tm, ~str> {
     }
 }
 
-fn strftime(format: &str, +tm: tm) -> ~str {
-    fn parse_type(ch: char, tm: &tm) -> ~str {
+fn strftime(format: &str, +tm: Tm) -> ~str {
+    fn parse_type(ch: char, tm: &Tm) -> ~str {
         //FIXME (#2350): Implement missing types.
       let die = || #fmt("strftime: can't understand this format %c ",
                              ch);
@@ -740,9 +740,9 @@ fn strftime(format: &str, +tm: tm) -> ~str {
     buf
 }
 
-impl tm {
+impl Tm {
     /// Convert time to the seconds from January 1, 1970
-    fn to_timespec() -> timespec {
+    fn to_timespec() -> Timespec {
         let mut sec = 0i64;
         if self.tm_gmtoff == 0_i32 {
             rustrt::rust_timegm(self, sec);
@@ -753,12 +753,12 @@ impl tm {
     }
 
     /// Convert time to the local timezone
-    fn to_local() -> tm {
+    fn to_local() -> Tm {
         at(self.to_timespec())
     }
 
     /// Convert time to the UTC
-    fn to_utc() -> tm {
+    fn to_utc() -> Tm {
         at_utc(self.to_timespec())
     }