mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Display duration of each activity session
This commit is contained in:
parent
745d24e124
commit
c0fbfcc58c
4 changed files with 15 additions and 4 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <Context.h>
|
||||
#include <Duration.h>
|
||||
#include <main.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
|
@ -168,7 +169,7 @@ std::string taskDifferences (const Task& before, const Task& after)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string taskInfoDifferences (const Task& before, const Task& after, const std::string& dateformat)
|
||||
std::string taskInfoDifferences (const Task& before, const Task& after, const std::string& dateformat, long& last_timestamp, const long current_timestamp)
|
||||
{
|
||||
// Attributes are all there is, so figure the different attribute names
|
||||
// between before and after.
|
||||
|
@ -205,6 +206,11 @@ std::string taskInfoDifferences (const Task& before, const Task& after, const st
|
|||
out << format (STRING_FEEDBACK_ANN_DEL, before.get (*name))
|
||||
<< "\n";
|
||||
}
|
||||
else if (*name == "start") {
|
||||
out << format (STRING_FEEDBACK_ATT_DEL_DUR, ucFirst (*name),
|
||||
Duration(current_timestamp - last_timestamp).formatPrecise())
|
||||
<< "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << format (STRING_FEEDBACK_ATT_DEL, ucFirst (*name))
|
||||
|
@ -230,10 +236,14 @@ std::string taskInfoDifferences (const Task& before, const Task& after, const st
|
|||
<< "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*name == "start")
|
||||
last_timestamp = current_timestamp;
|
||||
out << format (STRING_FEEDBACK_ATT_WAS_SET,
|
||||
ucFirst (*name),
|
||||
renderAttribute (*name, after.get (*name), dateformat))
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue