Fix: trimmer: use regexes to parse dates and times
This patch fixes a few issues related to how the trimmer component
parses timestamps.
1. Less than 9 digits in the nanoseconds position is not interpreted
correctly.
Passing "2019-01-02 12:34:56.444", we expect the nanosecond portion
to mean 444 ms, or
444000000 ns. Currently, it is interpreted as 444
ns.
2. We wrongfully accept missing digits in the various fields
It is currently possible to pass a date as "2019-1-2" (instead of
"2019-01-02") or a time as "1:2:3" (instead of "01:02:03"). This
patch makes the parsing stricter, in order to only accept the right
number of digits when parsing dates (in the form "YYYY-MM-DD") and
times (in the form "HH:MM:SS"). The nanosecond portion, if present,
can contain anywhere from 1 to 9 digits.
Change-Id: Ie315cec0bc7387ecdaa999d6c5f82f70035412f3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1389
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>