On Sat, Jan 5, 2013 at 1:07 AM, Urs Thuermann <[email protected]> wrote: > This patch simplifies considerably the functions do_time_format() and > format_date() used for %A, %C, and %T in the -printf predicate. > Instead of formatting the time using strftime(), then searching for > the seconds and appending a dot and the nanoseconds, one could simply > use nstrftime() from the GNU lib (already distributed with GNU > findutils) and use %N to get the nanoseconds. > > The format strings used with nstrftime() are > > %F+%T.%N0 for %T+ > %s.%N0 for %T@ > %S.%N0 for %TS > %T.%N0 for %TT > > Only for %TX no nanoseconds are printed anymore, since we don't know > how %X will be formatted by nstrftime(). > > This patch also makes nanoseconds availabe for -printf by using %TN.
I like the idea, and the added support for field widths could be useful. > I would also suggest reverting the change in findutils-4.3.3 that %TT > and %TS print nanosecond resolution. This change makes it difficult > to only print the seconds in the minute without nanoseconds. With > this patch the user could then achieve the same effect using %TT.%TN > or %TS.%TN, respecitvely. Perhaps this would have been a better way to do things in the first place, but I'm a bit reluctant to simply revert the change in case someone is relying on it (since this approach also gives no transition path). Do you have any suggestions for how we should proceed in making this change? James.
