diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-17 18:44:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-17 18:44:12 +0300 |
commit | d04b715a5d999e4744b828083aa5905e04dc9299 (patch) | |
tree | efa5c54528e4815c8fcd2342c0f9c39ac5056802 /plugins | |
parent | e5381d4e4b8e5657d9e7a275e293f2a42f7d74d8 (diff) |
export/import with human readable timestamps according to #1490
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Import/src/textjson.cpp | 17 | ||||
-rwxr-xr-x | plugins/Msg_Export/src/utils.cpp | 4 |
2 files changed, 19 insertions, 2 deletions
diff --git a/plugins/Import/src/textjson.cpp b/plugins/Import/src/textjson.cpp index 1267148550..79ec9e6f99 100644 --- a/plugins/Import/src/textjson.cpp +++ b/plugins/Import/src/textjson.cpp @@ -111,7 +111,22 @@ public: dbei->timestamp = tm; } } - + else { + szTime = (*node)["isotime"].as_string(); + if (!szTime.empty()) { + struct tm st = {}; + int res = sscanf(szTime.c_str(), "%4d-%2d-%2dT%2d:%2d:%2dZ", &st.tm_year, &st.tm_mon, &st.tm_mday, &st.tm_hour, &st.tm_min, &st.tm_sec); + if (res == 6) { + st.tm_mon--; + st.tm_mday--; + st.tm_year -= 1900; + time_t tm = mktime(&st); + if (tm != -1) + dbei->timestamp = tm; + } + } + } + if (dbei->timestamp == 0) dbei->timestamp = (*node)["timeStamp"].as_int(); diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index ddafc4b599..081ad6e86a 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -811,7 +811,9 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, wstring sFilePath if (g_bUseJson) {
JSONNode pRoot;
pRoot.push_back(JSONNode("type", dbei.eventType));
- pRoot.push_back(JSONNode("timeStamp", dbei.timestamp));
+
+ TimeZone_PrintTimeStamp(0, dbei.timestamp, L"I", szTemp, _countof(szTemp), 0);
+ pRoot.push_back(JSONNode("isotime", T2Utf(szTemp).get()));
std::string flags;
if (dbei.flags & DBEF_SENT)
|