diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-06-13 15:41:49 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 13:49:27 +0100 |
commit | 49fc021337eba2e9cea228e80e1f95ef21b30cd2 (patch) | |
tree | 0b6a15d8395baeac54e40f42eca9d5deb6b1b9db /lib/printf_test.c | |
parent | f047271cb963c62663687d63b2f7cf8dd5edfbb7 (diff) |
Printf: Add support for microsecond times
Use '%t' in bsnprintf() for microsecond times (in btime) with variable
sub-second precision.
Diffstat (limited to 'lib/printf_test.c')
-rw-r--r-- | lib/printf_test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/printf_test.c b/lib/printf_test.c index 3981d3da..a2683d93 100644 --- a/lib/printf_test.c +++ b/lib/printf_test.c @@ -56,6 +56,15 @@ t_simple(void) BSPRINTF(2, "-1", buf, "%d", -1); BSPRINTF(11, "-2147483648", buf, "%d", -2147483648); + BSPRINTF(7, "123.456", buf, "%t", (btime) 123456789); + BSPRINTF(7, "123.456", buf, "%2t", (btime) 123456789); + BSPRINTF(8, " 123.456", buf, "%8t", (btime) 123456789); + BSPRINTF(4, " 123", buf, "%4.0t", (btime) 123456789); + BSPRINTF(8, "123.4567", buf, "%8.4t", (btime) 123456789); + BSPRINTF(9, "0123.4567", buf, "%09.4t", (btime) 123456789); + BSPRINTF(12, " 123.456789", buf, "%12.10t", (btime) 123456789); + BSPRINTF(8, " 123.004", buf, "%8t", (btime) 123004 MS); + return 1; } |