diff options
| author | Ashok Gautham <ScriptDevil@gmail.com> | 2013-01-13 16:48:34 +0530 |
|---|---|---|
| committer | Ashok Gautham <ScriptDevil@gmail.com> | 2013-01-13 17:18:10 +0530 |
| commit | 406d2b3bfe6336c71b6aedd202bb896fc47b2587 (patch) | |
| tree | 4b9e64a76a0bb78d3b13e86a4f858e18506757c8 /src/libstd/time.rs | |
| parent | ca9358388a7deeffd9f645d08a5755248b0a7a2a (diff) | |
| download | rust-406d2b3bfe6336c71b6aedd202bb896fc47b2587.tar.gz rust-406d2b3bfe6336c71b6aedd202bb896fc47b2587.zip | |
Fix errors in how parsed time values were used
%u flag takes a value in the range of 1-7. However value needs to be stored in tm.tm_wday between 0 and 6. %y takes a two-digit year value. Subtracting 1900_i32 from it is not needed.
Diffstat (limited to 'src/libstd/time.rs')
| -rw-r--r-- | src/libstd/time.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 72132071a05..53fb51f08b3 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -551,7 +551,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> { match match_digits(s, pos, 1u, false) { Some(item) => { let (v, pos) = item; - tm.tm_wday = v; + tm.tm_wday = v-1_i32; Ok(pos) } None => Err(~"Invalid day of week") @@ -590,7 +590,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> { match match_digits(s, pos, 2u, false) { Some(item) => { let (v, pos) = item; - tm.tm_year = v - 1900_i32; + tm.tm_year = v; Ok(pos) } None => Err(~"Invalid year") |
