- Converted from OldDuration to Duration.
This commit is contained in:
Paul Beckingham 2014-05-28 23:55:20 -04:00
parent e73d19152e
commit 9693a724f2
2 changed files with 8 additions and 7 deletions

View file

@ -321,7 +321,7 @@ bool Duration::parse (const std::string& input, std::string::size_type& start)
if (durations[i].unit == unit) if (durations[i].unit == unit)
{ {
seconds = durations[i].seconds; seconds = durations[i].seconds;
_secs = static_cast <int> (quantity * static_cast <double> (seconds)); _secs = static_cast <int> (quantity * static_cast <double> (seconds));
return true; return true;
} }
} }

View file

@ -30,7 +30,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <algorithm> #include <algorithm>
#include <unistd.h> #include <unistd.h>
#include <OldDuration.h> #include <Duration.h>
#include <Context.h> #include <Context.h>
#include <Filter.h> #include <Filter.h>
#include <Nibbler.h> #include <Nibbler.h>
@ -150,7 +150,7 @@ std::string CmdEdit::formatDuration (
std::string value = task.get (attribute); std::string value = task.get (attribute);
if (value.length ()) if (value.length ())
{ {
OldDuration dur (value); Duration dur (value);
value = dur.formatSeconds (); value = dur.formatSeconds ();
} }
@ -536,8 +536,9 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
{ {
if (value != "") if (value != "")
{ {
OldDuration d; Duration d;
if (d.valid (value)) std::string::size_type idx = 0;
if (d.parse (value, idx))
{ {
context.footnote (STRING_EDIT_RECUR_MOD); context.footnote (STRING_EDIT_RECUR_MOD);
if (task.get ("due") != "") if (task.get ("due") != "")
@ -677,7 +678,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
if ((task.get (col->first) != value) && (type != "date" || if ((task.get (col->first) != value) && (type != "date" ||
(task.get (col->first) != Date (value, dateformat).toEpochString ())) && (task.get (col->first) != Date (value, dateformat).toEpochString ())) &&
(type != "duration" || (type != "duration" ||
(task.get (col->first) != (std::string) OldDuration (value) ))) (task.get (col->first) != (std::string) Duration (value) )))
{ {
if (value != "") if (value != "")
{ {
@ -704,7 +705,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
} }
else if (type == "duration") else if (type == "duration")
{ {
OldDuration d (value); Duration d (value);
task.set (col->first, (time_t) d); task.set (col->first, (time_t) d);
} }
} }