analyze: Add "timespan" command to dump time span in usec

This is useful for a couple of cases, I'm mostly interested in case #1:

1. Verifying "reasonable" values in a trivially scriptable way
2. Debugging unexpected time span parsing directly

Test Plan:

```
% build/systemd-analyze timespan 20
Original: 20
      μs: 20
   Human: 20us
% build/systemd-analyze timespan 20ms
Original: 20ms
      μs: 20000
   Human: 20ms
% build/systemd-analyze timespan 20z
Failed to parse time span '20z': Invalid argument
```
This commit is contained in:
Chris Down
2018-10-23 14:26:51 +02:00
committed by Lennart Poettering
parent f402ce827d
commit 3f1c1287a9
6 changed files with 46 additions and 2 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ static void test_keymaps(void) {
#define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x))
static void dump_special_glyphs(void) {
assert_cc(ELLIPSIS + 1 == _SPECIAL_GLYPH_MAX);
assert_cc(MU + 1 == _SPECIAL_GLYPH_MAX);
log_info("/* %s */", __func__);