From 6a0654c91bea5cbee91268bad1faa6b246da26af Mon Sep 17 00:00:00 2001 From: djcb Date: Sat, 4 Nov 2017 11:30:23 +0000 Subject: [PATCH] parser/utils: enforce 64-bit times on 32-bit platforms don't assume a 64-bit platform. --- lib/parser/utils.cc | 7 ++----- lib/parser/utils.hh | 7 ++++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/parser/utils.cc b/lib/parser/utils.cc index 825ca725..d79b778c 100644 --- a/lib/parser/utils.cc +++ b/lib/parser/utils.cc @@ -149,9 +149,6 @@ Mux::utf8_clean (const std::string& dirty) return clean; } - - - std::vector Mux::split (const std::string& str, const std::string& sepa) { @@ -213,7 +210,7 @@ date_boundary (bool is_first) } std::string -Mux::date_to_time_t_string (time_t t) +Mux::date_to_time_t_string (int64_t t) { char buf[sizeof(InternalDateMax)]; snprintf (buf, sizeof(buf), InternalDateFormat, t); @@ -332,7 +329,7 @@ Mux::date_to_time_t_string (const std::string& dstr, bool is_first) return date_boundary (is_first); } - t = (gint64)g_date_time_to_unix (dtime); + t = g_date_time_to_unix (dtime); g_date_time_unref (dtime); if (t < 0 || t > 9999999999) diff --git a/lib/parser/utils.hh b/lib/parser/utils.hh index 28494c15..71488de8 100644 --- a/lib/parser/utils.hh +++ b/lib/parser/utils.hh @@ -88,13 +88,14 @@ std::string format (const char *frm, ...) std::string date_to_time_t_string (const std::string& date, bool first); /** - * time_t expressed as a string with a 10-digit time_t + * 64-bit incarnation of time_t expressed as a 10-digit string. Uses 64-bit for the time-value, + * regardless of the size of time_t. * - * @param t + * @param t some time value * * @return */ -std::string date_to_time_t_string (time_t t); +std::string date_to_time_t_string (int64_t t);