summaryrefslogtreecommitdiff
path: root/plugins/Import/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-08-17 18:44:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-08-17 18:44:12 +0300
commitd04b715a5d999e4744b828083aa5905e04dc9299 (patch)
treeefa5c54528e4815c8fcd2342c0f9c39ac5056802 /plugins/Import/src
parente5381d4e4b8e5657d9e7a275e293f2a42f7d74d8 (diff)
export/import with human readable timestamps according to #1490
Diffstat (limited to 'plugins/Import/src')
-rw-r--r--plugins/Import/src/textjson.cpp17
1 files changed, 16 insertions, 1 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();