about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-10-03 14:01:41 -0700
committerbors <bors@rust-lang.org>2013-10-03 14:01:41 -0700
commit4bae639d86bd4c63040874dd5c305983832162c0 (patch)
treea2691145399b7c3f35b4170a6d8aa1e6abd2202d /src
parent012f909f3546dc7515b43ba389cfc0a1ead0d21f (diff)
parenta0c59941e3f6cca0ff1505c4ed431ac7327cc66a (diff)
downloadrust-4bae639d86bd4c63040874dd5c305983832162c0.tar.gz
rust-4bae639d86bd4c63040874dd5c305983832162c0.zip
auto merge of #9705 : luisbg/rust/strptime, r=alexcrichton
do_strptime() and do_strftime()

I don't see any reason why src/libextra/time.rs has two functions that just call a very similar function, which only use is to be called by them.
strftime() just calls do_strftime()
strptime() just calls do_strptime()
and the do_functions aren't called by anyone else.
the parameters and return types are exactly the same in both levels, so I just have removed the second layer.

Unless there is a need for that second level.
Diffstat (limited to 'src')
-rw-r--r--src/libextra/time.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/libextra/time.rs b/src/libextra/time.rs
index 795da44e224..c7add96fca1 100644
--- a/src/libextra/time.rs
+++ b/src/libextra/time.rs
@@ -174,15 +174,6 @@ pub fn now() -> Tm {
     at(get_time())
 }
 
-/// Parses the time from the string according to the format string.
-pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
-    do_strptime(s, format)
-}
-
-/// Formats the time according to the format string.
-pub fn strftime(format: &str, tm: &Tm) -> ~str {
-    do_strftime(format, tm)
-}
 
 impl Tm {
     /// Convert time to the seconds from January 1, 1970
@@ -264,7 +255,8 @@ impl Tm {
     }
 }
 
-fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
+/// Parses the time from the string according to the format string.
+pub fn strptime(s: &str, format: &str) -> Result<Tm, ~str> {
     fn match_str(s: &str, pos: uint, needle: &str) -> bool {
         let mut i = pos;
         for ch in needle.byte_iter() {
@@ -733,7 +725,8 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
     }
 }
 
-fn do_strftime(format: &str, tm: &Tm) -> ~str {
+/// Formats the time according to the format string.
+pub fn strftime(format: &str, tm: &Tm) -> ~str {
     fn days_in_year(year: int) -> i32 {
         if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) {
             366    /* Days in a leap year */