Enhancement

- Implemented Record::get_duration as a helper.
This commit is contained in:
Paul Beckingham 2011-07-01 22:21:25 -04:00
parent 63f91c2f88
commit 99d25bd0db
2 changed files with 11 additions and 0 deletions

View file

@ -178,6 +178,16 @@ time_t Record::get_date (const std::string& name) const
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)
{

View file

@ -51,6 +51,7 @@ public:
int get_int (const std::string&) const;
unsigned long get_ulong (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&, int);
void remove (const std::string&);