diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2025-11-13 15:32:15 +0100 |
|---|---|---|
| committer | Petr Mladek <pmladek@suse.com> | 2025-11-19 10:24:13 +0100 |
| commit | bccd5937447f8a2c9db0e4a92e5ecb641b8ce7de (patch) | |
| tree | 7ed133a34ed57374e9412f432fc66dfc350d3f2f /lib/tests | |
| parent | 48e3694ae7fae347c1193c84f384f4ea41086075 (diff) | |
lib/vsprintf: Add specifier for printing struct timespec64
A handful drivers want to print a content of the struct timespec64
in a format of %lld:%09ld. In order to make their lives easier, add
the respecting specifier directly to the printf() implementation.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Link: https://patch.msgid.link/20251113150217.3030010-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'lib/tests')
| -rw-r--r-- | lib/tests/printf_kunit.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c index bc54cca2d7a6..7617e5b8b02c 100644 --- a/lib/tests/printf_kunit.c +++ b/lib/tests/printf_kunit.c @@ -504,6 +504,7 @@ time_and_date(struct kunit *kunittest) }; /* 2019-01-04T15:32:23 */ time64_t t = 1546615943; + struct timespec64 ts = { .tv_sec = t, .tv_nsec = 11235813 }; test("(%pt?)", "%pt", &tm); test("2018-11-26T05:35:43", "%ptR", &tm); @@ -522,6 +523,9 @@ time_and_date(struct kunit *kunittest) test("0119-00-04 15:32:23", "%ptTsr", &t); test("15:32:23|2019-01-04", "%ptTts|%ptTds", &t, &t); test("15:32:23|0119-00-04", "%ptTtrs|%ptTdrs", &t, &t); + + test("2019-01-04T15:32:23.011235813", "%ptS", &ts); + test("1546615943.011235813", "%ptSp", &ts); } static void |