Fix: use return of bt_localtime_r as success criteria
[babeltrace.git] / src / plugins / utils / trimmer / trimmer.c
index c1c0f6921458cf963f814e41a80f31c4f9e94284..720b4f812b4a2c20c0ddd1000f36284031760316 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,12 +875,12 @@ 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);
                ret = -1;
This page took 0.024712 seconds and 4 git commands to generate.