diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-03 19:10:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-03 19:10:33 +0300 |
commit | 1b5e5bbb9f7abc2d56cf0ef0ffe7cd281854c874 (patch) | |
tree | 45c59c30b55c117807a964b120ef6df253fa1296 /protocols/Discord/src/utils.cpp | |
parent | e8ccd6330c478c4196dd1cedeeddf14add597784 (diff) |
server history syncing support
Diffstat (limited to 'protocols/Discord/src/utils.cpp')
-rw-r--r-- | protocols/Discord/src/utils.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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; |