From 1b5e5bbb9f7abc2d56cf0ef0ffe7cd281854c874 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 3 Jan 2017 19:10:33 +0300 Subject: server history syncing support --- protocols/Discord/src/utils.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'protocols/Discord/src/utils.cpp') diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp index 5913f6ef33..0513e49aac 100644 --- a/protocols/Discord/src/utils.cpp +++ b/protocols/Discord/src/utils.cpp @@ -46,6 +46,24 @@ JSONNode& operator<<(JSONNode &json, const WCHAR_PARAM ¶m) ///////////////////////////////////////////////////////////////////////////////////////// +time_t StringToDate(const CMStringW &str) +{ + struct tm T = { 0 }; + int boo; + if (swscanf(str, L"%04d-%02d-%02dT%02d:%02d:%02d.%d", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7) + return 0; + + T.tm_year -= 1900; + T.tm_mon--; + time_t t = mktime(&T); + + _tzset(); + t -= _timezone; + return (t >= 0) ? t : 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + SnowFlake CDiscordProto::getId(const char *szSetting) { DBVARIANT dbv; -- cgit v1.2.3