CmdInfo: Duration replaced by ISO8601p
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
#include <Filter.h>
|
#include <Filter.h>
|
||||||
#include <ISO8601.h>
|
#include <ISO8601.h>
|
||||||
#include <Date.h>
|
#include <Date.h>
|
||||||
#include <Duration.h>
|
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
@@ -230,7 +229,7 @@ int CmdInfo::execute (std::string& output)
|
|||||||
if (created.length ())
|
if (created.length ())
|
||||||
{
|
{
|
||||||
Date dt (strtol (created.c_str (), NULL, 10));
|
Date dt (strtol (created.c_str (), NULL, 10));
|
||||||
age = Duration (now - dt).format ();
|
age = ISO8601p (now - dt).format ();
|
||||||
}
|
}
|
||||||
|
|
||||||
view.set (row, 1, entry + " (" + age + ")");
|
view.set (row, 1, entry + " (" + age + ")");
|
||||||
@@ -290,7 +289,7 @@ int CmdInfo::execute (std::string& output)
|
|||||||
view.set (row, 0, STRING_CMD_INFO_MODIFIED);
|
view.set (row, 0, STRING_CMD_INFO_MODIFIED);
|
||||||
|
|
||||||
Date mod (task.get_date ("modified"));
|
Date mod (task.get_date ("modified"));
|
||||||
std::string age = Duration (now - mod).format ();
|
std::string age = ISO8601p (now - mod).format ();
|
||||||
view.set (row, 1, mod.toString (dateformat) + " (" + age + ")");
|
view.set (row, 1, mod.toString (dateformat) + " (" + age + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,17 +373,12 @@ int CmdInfo::execute (std::string& output)
|
|||||||
value = Date (value).toString (dateformat);
|
value = Date (value).toString (dateformat);
|
||||||
else if (type == "duration")
|
else if (type == "duration")
|
||||||
{
|
{
|
||||||
if (value[0] == 'P')
|
ISO8601p iso;
|
||||||
{
|
std::string::size_type cursor = 0;
|
||||||
ISO8601p iso;
|
if (iso.parse (value, cursor))
|
||||||
std::string::size_type cursor = 0;
|
value = (std::string) Variant ((time_t) iso._value, Variant::type_duration);
|
||||||
if (iso.parse (value, cursor))
|
|
||||||
value = (std::string) Variant ((time_t) iso._value, Variant::type_duration);
|
|
||||||
else
|
|
||||||
value = "PT0S";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
value = Duration (value).formatCompact ();
|
value = "PT0S";
|
||||||
}
|
}
|
||||||
|
|
||||||
view.set (row, 1, value);
|
view.set (row, 1, value);
|
||||||
|
|||||||
Reference in New Issue
Block a user