Commit 9e65fb84 authored by Michael Ott's avatar Michael Ott
Browse files

Facilitate parsing of POSIC timestamps in s, ms, ns, us

parent 604afce4
......@@ -96,7 +96,17 @@ void TimeStamp::guessFromString(std::string timestr, bool localTime)
/* Try to match it against a POSIX time */
if (sscanf(timestr.c_str(), "%" PRIu64, &tmp) == 1) {
raw = tmp * 1000 * 1000 * 1000;
/* Checker whether it is a date before 2070-12-31 */
if (tmp < 31872923400ull) { // s
raw = tmp * 1000 * 1000 * 1000;
} else if (tmp < 31872923400000ull) { // ms
raw = tmp * 1000 * 1000;
} else if (tmp < 31872923400000000ull) { // ns
raw = tmp * 1000;
} else { // us
raw = tmp;
}
if (localTime) {
convertFromLocal();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment