From 04e1a4f5c8c4172ca36dd79dfd0731f4aba873a5 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 12 Mar 2024 00:14:13 +0000 Subject: Add a protocol module function for extracting timestamps. --- src/protocol.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/protocol.cpp b/src/protocol.cpp index 5699a2d48..55603c8e7 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -86,6 +86,14 @@ Anope::string IRCDProto::SID_Retrieve() return current_sid; } +time_t IRCDProto::ExtractTimestamp(const Anope::string &str) +{ + auto ts = Anope::TryConvert(str); + if (!ts.has_value()) + throw ProtocolException("Invalid timestamp: " + str); + return ts.value(); +} + void IRCDProto::SendError(const Anope::string &reason) { Uplink::Send("ERROR", reason); -- cgit