mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 13:23:56 -07:00
Enhance lobby / XMPP timestamp parsing documentation.
Refs #3832,9a5e1ddedb/ D760,6141c5c4fa/ D514 Reviewed By: leper This was SVN commit r20032.
This commit is contained in:
parent
a89c32f36b
commit
f27efac053
1 changed files with 4 additions and 3 deletions
|
|
@ -933,9 +933,10 @@ void XmppClient::GetRole(const std::string& nick, std::string& role)
|
|||
*****************************************************/
|
||||
|
||||
/**
|
||||
* Compute the POSIX timestamp of a message. Uses message datetime when possible, current time otherwise.
|
||||
* Parse and return the timestamp of a historic chat message and return the current time for new chat messages.
|
||||
* Historic chat messages are implement as DelayedDelivers as specified in XEP-0203.
|
||||
* Hence, their timestamp MUST be in UTC and conform to the DateTime format XEP-0082.
|
||||
*
|
||||
* @param msg The message on which to base the computation.
|
||||
* @returns Seconds since the epoch.
|
||||
*/
|
||||
std::time_t XmppClient::ComputeTimestamp(const glooxwrapper::Message& msg) const
|
||||
|
|
@ -944,7 +945,7 @@ std::time_t XmppClient::ComputeTimestamp(const glooxwrapper::Message& msg) const
|
|||
if (!msg.when())
|
||||
return std::time(nullptr);
|
||||
|
||||
// See XEP-0082 for the date format
|
||||
// The locale is irrelevant, because the XMPP date format doesn't contain written month names
|
||||
return g_L10n.ParseDateTime(msg.when()->stamp().to_string(), "Y-M-d'T'H:m:sZ", Locale::getUS()) / 1000.0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue