summaryrefslogtreecommitdiff
path: root/include/inspircd.h
diff options
context:
space:
mode:
authorlinuxdaemon <linuxdaemon@users.noreply.github.com>2018-12-21 12:37:22 -0600
committerPeter Powell <petpow@saberuk.com>2018-12-21 19:37:22 +0100
commit7530285740c2db1bc4457859b0d5f2436e0ed113 (patch)
tree89635613725a1b7ad6e262d7e3035a518d42e8d2 /include/inspircd.h
parent60ae49b62a371791ebbd9e4b131e33b857873f06 (diff)
Only parse valid durations, don't treat invalid multipliers as seconds (#1538)
Diffstat (limited to 'include/inspircd.h')
-rw-r--r--include/inspircd.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index a563edc7f..8ca2314eb 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -502,6 +502,14 @@ class CoreExport InspIRCd
*/
static unsigned long Duration(const std::string& str);
+ /** Calculate a duration in seconds from a string in the form 1y2w3d4h6m5s
+ * @param str A string containing a time in the form 1y2w3d4h6m5s
+ * (one year, two weeks, three days, four hours, six minutes and five seconds)
+ * @param duration The location to place the parsed duration valur
+ * @return Whether the duration was a valid format or not
+ */
+ static bool Duration(const std::string& str, unsigned long& duration);
+
/** Determines whether a string contains a valid duration.
* @param str A string containing a time in the form 1y2w3d4h6m5s
* @return True if the string is a valid duration; otherwise, false.