diff options
-rw-r--r-- | src/basic/time-util.c | 2 | ||||
-rw-r--r-- | src/test/test-time.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/time-util.c b/src/basic/time-util.c index cbdfd55ada..7a5b29d77e 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -883,6 +883,7 @@ static char* extract_multiplier(char *p, usec_t *multiplier) { { "y", USEC_PER_YEAR }, { "usec", 1ULL }, { "us", 1ULL }, + { "µs", 1ULL }, }; unsigned i; @@ -1016,6 +1017,7 @@ int parse_nsec(const char *t, nsec_t *nsec) { { "y", NSEC_PER_YEAR }, { "usec", NSEC_PER_USEC }, { "us", NSEC_PER_USEC }, + { "µs", NSEC_PER_USEC }, { "nsec", 1ULL }, { "ns", 1ULL }, { "", 1ULL }, /* default is nsec */ diff --git a/src/test/test-time.c b/src/test/test-time.c index 7078a0374d..8259491813 100644 --- a/src/test/test-time.c +++ b/src/test/test-time.c @@ -42,6 +42,10 @@ static void test_parse_sec(void) { assert_se(u == 2500 * USEC_PER_MSEC); assert_se(parse_sec(".7", &u) >= 0); assert_se(u == 700 * USEC_PER_MSEC); + assert_se(parse_sec("23us", &u) >= 0); + assert_se(u == 23); + assert_se(parse_sec("23µs", &u) >= 0); + assert_se(u == 23); assert_se(parse_sec("infinity", &u) >= 0); assert_se(u == USEC_INFINITY); assert_se(parse_sec(" infinity ", &u) >= 0); |