Fix: use return of bt_localtime_r as success criteria
Encountered error:
jenkins@ci-node-bionic-amd64-05-10:~/babeltrace/tests/cli$ TZ=EST4 ./../utils/../../src/cli/babeltrace2 ./../utils/../data/ctf-traces/succeed/wk-heartbeat-u/ --begin 12:48:17.
587029529
07-09 15:31:04.183
1224375 1224375 E PLUGIN/FLT.UTILS.TRIMMER Cannot convert timestamp to date and time: No such file or directory[trimmer] ts=
1351532897
07-09 15:31:04.183
1224375 1224375 W LIB/MSG-ITER @iterator.c:865 Component input port message iterator's "next" method failed: iter-addr=0x55705c7ee870, iter-type=BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT, iter-upstream-comp-name="trimmer", iter-upstream-comp-log-level=BT_LOGGING_LEVEL_WARN, iter-upstream-comp-class-type=BT_COMPONENT_CLASS_TYPE_FILTER, iter-upstream-comp-class-name="trimmer", iter-upstream-comp-class-partial-descr="Keep messages that occur within ", iter-upstream-port-type=BT_PORT_TYPE_OUTPUT, iter-upstream-port-name="out", status=ERROR
07-09 15:31:04.183
1224375 1224375 W LIB/GRAPH @graph.c:580 Component's "consume" method failed: status=ERROR, comp-addr=0x55705c7ec4a0, comp-name="pretty", comp-log-level=BT_LOGGING_LEVEL_WARN, comp-class-type=BT_COMPONENT_CLASS_TYPE_SINK, comp-class-name="pretty", comp-class-partial-descr="Pretty-print messages (`text` fo", comp-class-is-frozen=0, comp-class-so-handle-addr=0x55705c808840, comp-class-so-handle-path="/home/jenkins/babeltrace/src/plugins/text/babeltrace-plugin-text.la", comp-input-port-count=1, comp-output-port-count=0
07-09 15:31:04.183
1224375 1224375 E CLI Graph failed to complete successfully
But the same use of TZ=EST4 works fine on date.
bt_localtime_r behave the same as localtime_r. The success criteria of
localtime_r is that the returned pointer is not null. Checking the value
of errno as a success criteria is never a good idea.
man errno:
The value in errno is significant only when the return value of the
call indicated an error (i.e., -1 from most system calls; -1 or NULL
from most library functions); a function that succeeds is allowed to
change errno. The value of errno is never set to zero by any system
call or library function.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I1454ed1d5f8fe2aa095c8fcbb7b315bcb3c83871
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1664
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>