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

Re: PATCH: support for nanosecond timestamps



On Thu, 01 Nov 2007 17:37:53 +0000
Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> Stephane Chazelas wrote:
> > What about returning floating point numbers for zstat?
> 
> I've just looked at the documentation for stat to see how that might
> work. It'd end up returning the string representation rather than a float
> given the current interface. What exactly were you envisaging? It might
> be more useful to have it available with the -F (format) option. The only
> trouble there is that there is no standard for the letters to use in the
> format specifiers.  date(1) on Linux has %N for nanoseconds.

%N seems reasonable, although I'm wondering if we might actually be
better off with a specification for floating point seconds; we could
then use the same thing in zsh/datetime where we only get microsecond
resolution from gettimeofday().  Either way, it would probably be good
to add this to ztrftime() and expand the interface to include a
(possibly NULL) pointer to whatever gives the extra resolution.  Would
it be too horrible to allow formats like "%.9s"?  We'd have to restrict
it to %S and %s which are the only two where it makes sense, and we
would have to decide what to do about E and O modifiers and glibc flag
additions; simply passing them straight through and not allowing a
fractional second in such cases would probably be good enough.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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