trimmer: proper formatting of timestamp conversion error
[babeltrace.git] / src / plugins / utils / trimmer / trimmer.c
index 763c898660d3ff3263528ef7f89403c29a8a083a..79ceed0a9a79bf5ab29d262fc217f5d757d27bf5 100644 (file)
@@ -866,6 +866,7 @@ int set_trimmer_iterator_bound(struct trimmer_iterator *trimmer_it,
 {
        struct trimmer_comp *trimmer_comp = trimmer_it->trimmer_comp;
        struct tm tm;
+       struct tm *res;
        time_t time_seconds = (time_t) (ns_from_origin / NS_PER_S);
        int ret = 0;
 
@@ -874,14 +875,14 @@ int set_trimmer_iterator_bound(struct trimmer_iterator *trimmer_it,
 
        /* We only need to extract the date from this time */
        if (is_gmt) {
-               bt_gmtime_r(&time_seconds, &tm);
+               res = bt_gmtime_r(&time_seconds, &tm);
        } else {
-               bt_localtime_r(&time_seconds, &tm);
+               res = bt_localtime_r(&time_seconds, &tm);
        }
 
-       if (errno) {
+       if (!res) {
                BT_COMP_LOGE_ERRNO("Cannot convert timestamp to date and time",
-                       "ts=%" PRId64, (int64_t) time_seconds);
+                       "ts=%" PRId64, (int64_t) time_seconds);
                ret = -1;
                goto end;
        }
@@ -1349,7 +1350,6 @@ handle_message_with_stream(
                 * couldn't be using the trimmer component.
                 */
                BT_ASSERT(ns_from_origin);
-               BT_ASSERT(sstate->cur_packet);
 
                if (G_UNLIKELY(!trimmer_it->end.is_infinite &&
                                *ns_from_origin > trimmer_it->end.ns_from_origin)) {
This page took 0.025504 seconds and 4 git commands to generate.