Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: support for nanosecond timestamps



On Mon, Nov 05, 2007 at 02:45:50PM +0000, Oliver Kiddle wrote:
[...]
> Formats like %.9s make a certain amount of logical sense though you
> might expect that to output the seconds too, e.g.: 23.562827621
> It might be better to allow %6N and %3N given that %N is a non-standard
> extension already.
[...]

Again, ksh93:

$ ksh -c 'printf "%(%.s)T\n"'
1194276214.312372000
$ ksh -c 'printf "%(%.9s)T\n"'
1194276216.337172000
$ ksh -c 'printf "%(%.3s)T\n"'
1194276220.963
$ ksh -c 'printf "%(%s)T\n"'
1194276238
$ ksh -c 'printf "%(%N)T\n"'
001528000
$ ksh -c 'printf "%(%3N)T\n"'
576
$ ksh -c 'printf "%(%6N)T\n"'
825647

For %<x>N, the question is: "should they be zero-padded?"

-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author