summaryrefslogtreecommitdiffstats
path: root/src/timetype.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-16 10:50:09 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-09-16 10:51:21 +0200
commitb1e120f29b6a8886c7f5397b3f3d838bd9b140b9 (patch)
tree1acb0b5b430e5a3d1f0429ed187ea3db53d2c8a3 /src/timetype.rs
parent3660f0608e25cf0c48561a5c89f4fa080a0eb564 (diff)
Move utility functions to util package
Diffstat (limited to 'src/timetype.rs')
-rw-r--r--src/timetype.rs89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/timetype.rs b/src/timetype.rs
index 961a9b3..1c076ae 100644
--- a/src/timetype.rs
+++ b/src/timetype.rs
@@ -561,38 +561,6 @@ fn add_to_years(amount: i64, tt: TimeType) -> Result<TimeType> {
}
}
-#[inline]
-fn adjust_times_add(mut y: i64, mut mo: i64, mut d: i64, mut h: i64, mut mi: i64, mut s: i64)
- -> (i64, i64, i64, i64, i64, i64)
-{
- macro_rules! fix {
- {
- $base:ident,
- $border:expr,
- $next:ident
- } => {
- while $base >= $border {
- $next += 1;
- $base -= $border;
- }
- }
- }
-
- fix! { s , 60, mi }
- fix! { mi, 60, h }
- fix! { h , 24, d }
-
- if mo == 1 || mo == 3 || mo == 5 || mo == 7 || mo == 8 || mo == 10 || mo == 12 {
- fix! { d , 31, mo }
- } else {
- fix! { d , 30, mo }
- }
-
- fix! { mo, 12, y }
-
- (y, mo, d, h, mi, s)
-}
-
fn add_to_moment(mom: NaiveDateTime, tt: TimeType) -> Result<TimeType> {
use timetype::TimeType as TT;
@@ -859,63 +827,6 @@ fn sub_from_years(amount: i64, tt: TimeType) -> Result<TimeType> {
}
}
-#[inline]
-fn adjust_times_sub(mut y: i64, mut mo: i64, mut d: i64, mut h: i64, mut mi: i64, mut s: i64)
- -> (i64, i64, i64, i64, i64, i64)
-{
-
- println!("s < 0 -> = {}", s);
- if s < 0 {
- println!("mi -= {}", (s.abs() / 60) + 1);
- println!("s = {}", (60 - (0 - s).abs()));
-
- mi -= (s.abs() / 60) + 1;
- s = 60 - (0 - s).abs();
- }
- println!("");
-
- println!("mi < 0 -> = {}", mi);
- if mi < 0 {
- println!("h -= {}", (mi.abs() / 60) + 1);
- println!("mi = {}", (60 - (0 - mi).abs()));
-
- h -= (mi.abs() / 60) + 1;
- mi = 60 - (0 - mi).abs();
- }
- println!("");
-
- println!("h < 0 -> = {}", h);
- if h < 0 {
- println!("d -= {}", (h.abs() / 24) + 1);
- println!("h = {}", (24 - (0 - h).abs()));
-
- d -= (h.abs() / 24) + 1;
- h = 24 - (0 - h).abs();
- }
- println!("");
-
- println!("d < 1 -> = {}", d);
- if d < 1 {
- println!("mo -= {}", (d.abs() / 32) + 1);
- println!("d = {}", (31 - (0 - d).abs()));
-
- mo -= (d.abs() / 32) + 1;
- d = 31 - (0 - d).abs();
- }
- println!("");
-
- println!("mo < 1 -> = {}", mo);
- if mo < 1 {
- println!("y -= {}", (mo.abs() / 13) + 1);
- println!("mo = {}", (12 - (0 - mo).abs()));
-
- y -= (mo.abs() / 13) + 1;
- mo = 12 - (0 - mo).abs();
- }
-
- (y, mo, d, h, mi, s)
-}
-
fn sub_from_moment(mom: NaiveDateTime, tt: TimeType) -> Result<TimeType> {
use timetype::TimeType as TT;