diff options
| author | 2023-01-04 19:46:53 +0000 | |
|---|---|---|
| committer | 2023-01-04 19:56:57 +0000 | |
| commit | 26c6a8811b93c2dae412bd238af0aaf2b28b2328 (patch) | |
| tree | 203bd351880320a3c7b3336dc8040dc0a27a9936 /include/modules | |
| parent | Misc DNSBL code cleanup. (diff) | |
Allow specifying milliseconds and a timespec in the server-time API.
Diffstat (limited to 'include/modules')
| -rw-r--r-- | include/modules/ircv3_servertime.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/modules/ircv3_servertime.h b/include/modules/ircv3_servertime.h index 3f7f20d7c..c5cc7b2b2 100644 --- a/include/modules/ircv3_servertime.h +++ b/include/modules/ircv3_servertime.h @@ -63,11 +63,21 @@ public: /** Set the server time on a message. * @param msg Message to set the time on. No-op if the message already has server time set. - * @param t Unix timestamp to set. + * @param ts Timestamp to set. */ - void Set(ClientProtocol::Message& msg, time_t t) + void Set(ClientProtocol::Message& msg, const timespec& ts) { - Set(msg, FormatTime(t)); + Set(msg, FormatTime(ts.tv_sec, ts.tv_nsec / 1'000'000)); + } + + /** Set the server time on a message. + * @param msg Message to set the time on. No-op if the message already has server time set. + * @param secs UNIX timestamp to set. + * @param millisecs Number of milliseconds to set. + */ + void Set(ClientProtocol::Message& msg, time_t secs, long millisecs = 0) + { + Set(msg, FormatTime(secs, millisecs)); } /** Set the server time on a message. |
