- Renamed Duration object to OldDuration so that the two implementations can
  coexist in a binary.
This commit is contained in:
Paul Beckingham 2014-01-02 01:06:48 -05:00
parent 9bfe40fac7
commit 18f03c25b4
20 changed files with 566 additions and 566 deletions

View file

@ -933,7 +933,7 @@ void Chart::calculateRates (std::vector <time_t>& sequence)
int remaining_days = (int) (current_pending / (fix_rate - find_rate));
Date now;
Duration delta (remaining_days * 86400);
OldDuration delta (remaining_days * 86400);
now += delta;
completion = now.toString (context.config.get ("dateformat"))

View file

@ -149,7 +149,7 @@ std::string CmdEdit::formatDuration (
std::string value = task.get (attribute);
if (value.length ())
{
Duration dur (value);
OldDuration dur (value);
value = dur.formatSeconds ();
}
@ -534,7 +534,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
{
if (value != "")
{
Duration d;
OldDuration d;
if (d.valid (value))
{
context.footnote (STRING_EDIT_RECUR_MOD);
@ -710,7 +710,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
}
else if (type == "duration")
{
Duration d (value);
OldDuration d (value);
task.set (col->first, (time_t) d);
}
}

View file

@ -293,7 +293,7 @@ int CmdInfo::execute (std::string& output)
if (created.length ())
{
Date dt (strtol (created.c_str (), NULL, 10));
age = Duration (now - dt).format ();
age = OldDuration (now - dt).format ();
}
view.set (row, 1, entry + " (" + age + ")");
@ -311,7 +311,7 @@ int CmdInfo::execute (std::string& output)
Date mod (task->get_date ("modified"));
std::string age = Duration (now - mod).format ();
std::string age = OldDuration (now - mod).format ();
view.set (row, 1, Date (task->get_date ("modified")).toString (dateformat) +
" (" + age + ")");
}
@ -337,7 +337,7 @@ int CmdInfo::execute (std::string& output)
if (type == "date")
value = Date (value).toString (dateformat);
else if (type == "duration")
value = Duration (value).formatCompact ();
value = OldDuration (value).formatCompact ();
view.set (row, 1, value);
}
@ -433,7 +433,7 @@ int CmdInfo::execute (std::string& output)
{
row = journal.addRow ();
journal.set (row, 0, STRING_CMD_INFO_TOTAL_ACTIVE);
journal.set (row, 1, Duration (total_time).formatPrecise (),
journal.set (row, 1, OldDuration (total_time).formatPrecise (),
(context.color () ? Color ("bold") : Color ()));
}
}

View file

@ -238,35 +238,35 @@ int CmdStats::execute (std::string& output)
row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_USED_FOR);
view.set (row, 1, Duration (latest - earliest).format ());
view.set (row, 1, OldDuration (latest - earliest).format ());
}
if (totalT)
{
row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_ADD_EVERY);
view.set (row, 1, Duration (((latest - earliest) / totalT)).format ());
view.set (row, 1, OldDuration (((latest - earliest) / totalT)).format ());
}
if (completedT)
{
row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_COMP_EVERY);
view.set (row, 1, Duration ((latest - earliest) / completedT).format ());
view.set (row, 1, OldDuration ((latest - earliest) / completedT).format ());
}
if (deletedT)
{
row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_DEL_EVERY);
view.set (row, 1, Duration ((latest - earliest) / deletedT).format ());
view.set (row, 1, OldDuration ((latest - earliest) / deletedT).format ());
}
if (pendingT || completedT)
{
row = view.addRow ();
view.set (row, 0, STRING_CMD_STATS_AVG_PEND);
view.set (row, 1, Duration ((int) ((daysPending / (pendingT + completedT)) * 86400)).format ());
view.set (row, 1, OldDuration ((int) ((daysPending / (pendingT + completedT)) * 86400)).format ());
}
if (totalT)

View file

@ -159,7 +159,7 @@ int CmdSummary::execute (std::string& output)
view.set (row, 1, countPending[i->first]);
if (counter[i->first])
view.set (row, 2, Duration ((int) (sumEntry[i->first] / (double)counter[i->first])).format ());
view.set (row, 2, OldDuration ((int) (sumEntry[i->first] / (double)counter[i->first])).format ());
int c = countCompleted[i->first];
int p = countPending[i->first];

View file

@ -552,7 +552,7 @@ void Command::modify_task (
long l = (long) strtod (result.c_str (), NULL);
if (labs (l) < 5 * 365 * 86400)
{
Duration dur (value);
OldDuration dur (value);
Date now;
now += l;
task.set (name, now.toEpochString ());
@ -564,7 +564,7 @@ void Command::modify_task (
}
}
// Durations too.
// OldDurations too.
else if (name == "recur" ||
column->type () == "duration")
{
@ -577,7 +577,7 @@ void Command::modify_task (
std::string result = e.evalExpression (task);
context.debug (std::string ("Eval '") + value + "' --> '" + result + "'");
Duration d (value);
OldDuration d (value);
// Deliberately storing the 'raw' value, which is necessary for
// durations like 'weekday'..