bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
#include <SimpleTimeParser.h>
Static Public Member Functions | |
static bool | parseIntoSeconds (long &seconds, const std::string &duration) |
Helper class to parse in very simple string specifications of times and return it as an (approximate) duration in seconds. By approximate, we use a month to be 31 days and a year to be 365 days for purposes of converting to seconds.
We only can parse strings of the form "%d %unit" where d stands for a number and unit stands for a single basic time unit in this list. We give the unit and then the strings that can be used to represent it.
seconds: { s, second, seconds } minutes: { m, min, mins } hours: { h, hour, hours } days: { day, days } weeks: { week, weeks} months: { month, months } [note: month considered 31 days!] years: { year, years }
For example:
"1 min" "3 s" "5 hours" "3 days" "10 seconds" "5 years" "1 month"
TODO This probably should be tested using CPPUnit
Definition at line 73 of file SimpleTimeParser.h.
agg_util::SimpleTimeParser::SimpleTimeParser | ( | ) |
Definition at line 49 of file SimpleTimeParser.cc.
agg_util::SimpleTimeParser::~SimpleTimeParser | ( | ) |
Definition at line 53 of file SimpleTimeParser.cc.
|
static |
Parse the string in duration and to calculate the (approximate) number of seconds it represents. By approximate, we mean that a month is considered 31 days and a year as 365 days.
seconds | the result will be placed in here on success |
duration | time duration as specified in class docs. |
Definition at line 57 of file SimpleTimeParser.cc.