X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules%2Fircv3_servertime.h;h=4befbaabae2931f8ab54e72b151a81d2b634f892;hb=b191657921845a26128e910bfff0f21251e98ee4;hp=b917531a0207945e2f5358946d00a0dff0209180;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules/ircv3_servertime.h b/include/modules/ircv3_servertime.h index b917531a0..4befbaaba 100644 --- a/include/modules/ircv3_servertime.h +++ b/include/modules/ircv3_servertime.h @@ -1,7 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2016 Attila Molnar + * Copyright (C) 2018-2019 Sadie Powell + * Copyright (C) 2018 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -27,12 +28,15 @@ namespace IRCv3 class API; /** Format a unix timestamp into the format used by server-time. - * @param t Time to format. + * @param secs UNIX timestamp to format. + * @params millisecs Number of milliseconds to format. * @return Time in server-time format, as a string. */ - inline std::string FormatTime(time_t t) + inline std::string FormatTime(time_t secs, long millisecs = 0) { - return InspIRCd::TimeString(t, "%Y-%m-%dT%H:%M:%S.000Z", true); + std::string timestr = InspIRCd::TimeString(secs, "%Y-%m-%dT%H:%M:%S.Z", true); + timestr.insert(20, InspIRCd::Format("%03ld", millisecs)); + return timestr; } } }