Resolved: strftime() should provide a way to access sub-second info

David Wolfskill david at catwhisker.org
Fri Nov 19 10:25:02 PST 2010


At least in FreeBSD, date(1) can use whatever "format" specification
strftime() can grok; using that, one may customize the output fairly
flexibly.

However (again, in FreeBSD), there does not seem to be a strftime()
specification to request the fractions of a second.  And 1 second is
rather a long time for a computer nowadays....

I'm thinkking of writing a patch to strftime() to enable this, but I
think of at least a couple of ways to accomplish this -- e.g.:

* Provide a conversion character that is replaced by a floating-point
  value X, 0 <= X < 1.  I'm not keen on this, as I doubt that
  strftime() currently makes use of floating-point, and I'd rather
  not impose floating-poiont as a requirement for this ability.  (I
  haven't actually looked at the code yet.)

* Provide 2 conversion characters: one for the value (as an integer);
  the other (also an integer) to be an exponent of 10 to be used to
  normalize the value (e.g., -6 for microseconds).

* Provide 2 conversion charactewrs: one for the value (as an integer);
  the other (also an integer) to be the denominator of the fraction (for
  which the first value is the numerator) (e.g., 1000000 for
  microseconds).

I don't want to get too involved in "licensing" issues (my code
would be BSD-licensed), but I think it would be helpful if different
implementations had similar APIs.

So does anyone know offhand of prior applicable art?

Peace,
david
-- 
David H. Wolfskill				david at catwhisker.org
Depriving a girl or boy of an opportunity for education is evil.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://www.baylisa.org/pipermail/baylisa/attachments/20101119/e1e79852/attachment.bin>


More information about the Baylisa mailing list