From 394f3a47e464b67b17e2cb7166df066829250e88 Mon Sep 17 00:00:00 2001 From: dana Date: Wed, 20 Jun 2018 17:29:56 -0500 Subject: 43075: Support nanosecond-precision time formatting * Teach ztrftime() %9. and %N for nanoseconds * Update prompt expansion to pass sub-second times for time formatting * Update zsh/stat to pass sub-second times for atime/mtime/ctime Patch heavily based on Oliver's earlier work @ workers/24059 --- Doc/Zsh/prompt.yo | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Doc/Zsh/prompt.yo') diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo index 3c8f2a094..909012c8e 100644 --- a/Doc/Zsh/prompt.yo +++ b/Doc/Zsh/prompt.yo @@ -198,11 +198,15 @@ endsitem() In addition, if the system supports the POSIX tt(gettimeofday) system call, tt(%.) provides decimal fractions of a second since the epoch with leading zeroes. By default three decimal places are provided, but a -number of digits up to 6 may be given following the tt(%); hence tt(%6.) -outputs microseconds. A typical example of this is the format -`tt(%D{%H:%M:%S.%.})'. +number of digits up to 9 may be given following the tt(%); hence tt(%6.) +outputs microseconds, and tt(%9.) outputs nanoseconds. (The latter +requires a nanosecond-precision tt(clock_gettime); systems lacking this +will return a value multiplied by the appropriate power of 10.) A typical +example of this is the format `tt(%D{%H:%M:%S.%.})'. -The GNU extension that a `tt(-)' between the tt(%) and the +The GNU extension tt(%N) is handled as a synonym for tt(%9.). + +Additionally, the GNU extension that a `tt(-)' between the tt(%) and the format character causes a leading zero or space to be stripped is handled directly by the shell for the format characters tt(d), tt(f), tt(H), tt(k), tt(l), tt(m), tt(M), tt(S) and tt(y); any other format -- cgit 1.4.1