about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-01-26 15:45:00 -0800
committerBrian Anderson <banderson@mozilla.com>2012-01-26 15:45:02 -0800
commit6d360d2b026dbfd9cd8a5dc1b25e452c7fa544ee (patch)
tree43aecc9e8fdea6340426cf64b5e68c020925104d
parent5e250b695113c87e2183bb3b03160ae02fd748d1 (diff)
downloadrust-6d360d2b026dbfd9cd8a5dc1b25e452c7fa544ee.tar.gz
rust-6d360d2b026dbfd9cd8a5dc1b25e452c7fa544ee.zip
tutorial: Fix types in gettimeofday example. Closes #1657
-rw-r--r--doc/tutorial.md8
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md
index 5a38598f16e..9a955f8a8b8 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -2334,17 +2334,19 @@ microsecond-resolution timer.
 
 ~~~~
 use std;
-type timeval = {mutable tv_sec: u32,
-                mutable tv_usec: u32};
+type timeval = {mutable tv_sec: uint,
+                mutable tv_usec: uint};
 #[nolink]
 native mod libc {
     fn gettimeofday(tv: *timeval, tz: *()) -> i32;
 }
 fn unix_time_in_microseconds() -> u64 unsafe {
-    let x = {mutable tv_sec: 0u32, mutable tv_usec: 0u32};
+    let x = {mutable tv_sec: 0u, mutable tv_usec: 0u};
     libc::gettimeofday(ptr::addr_of(x), ptr::null());
     ret (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
 }
+
+# fn main() { assert #fmt("%?", unix_time_in_microseconds()) != ""; }
 ~~~~
 
 The `#[nolink]` attribute indicates that there's no native library to link