mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement
- Implemented Record::get_duration as a helper.
This commit is contained in:
parent
63f91c2f88
commit
99d25bd0db
2 changed files with 11 additions and 0 deletions
|
@ -178,6 +178,16 @@ time_t Record::get_date (const std::string& name) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
time_t Record::get_duration (const std::string& name) const
|
||||||
|
{
|
||||||
|
Record::const_iterator i = this->find (name);
|
||||||
|
if (i != this->end ())
|
||||||
|
return (time_t) strtoul (i->second.value ().c_str (), NULL, 10);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Record::set (const std::string& name, const std::string& value)
|
void Record::set (const std::string& name, const std::string& value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
int get_int (const std::string&) const;
|
int get_int (const std::string&) const;
|
||||||
unsigned long get_ulong (const std::string&) const;
|
unsigned long get_ulong (const std::string&) const;
|
||||||
time_t get_date (const std::string&) const;
|
time_t get_date (const std::string&) const;
|
||||||
|
time_t get_duration (const std::string&) const;
|
||||||
void set (const std::string&, const std::string&);
|
void set (const std::string&, const std::string&);
|
||||||
void set (const std::string&, int);
|
void set (const std::string&, int);
|
||||||
void remove (const std::string&);
|
void remove (const std::string&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue