strftime's time format does not support fractional seconds, but a lot of people want to do that, based on a google search. It's been implemented as an extension to several programs.

Each implementation I found uses a different conversion specification, and in each case the character chosen was already used by something else in the standard strftime. The only unused letters are: %f, %i %J %K %L %q %Q %w (and perhaps some punctuation). Of these, "%f" has a good mnemonic for fractional seconds. But I hestiate to poach from such a small space.

Looking at glibc's extensions to the strftime format suggested a different approach. I suggest using "%.S" for fractional seconds. There's a good mnemoic and this seems unlikely to be used for anything else. This could be extended to include an optional precision ("%.4S").

It would also be nice to have a standard way of showing microseconds, nanoseconds, and milliseconds too. "%uS", "%nS", and "%mS" would be nice to use; unfortunatly, "%u", "%n", and "%m" are already used in strftime (so are "%U, "%N", and "%M"). I don't have a solution for these, but they're probably generally less useful than fractional seconds anyway.


Update: I neglected to mention the possibility of using the O modifier. Dirk Eddelbuettel points out that R uses "%OS" for fractional seconds.

As compromises go, R has chosen a pretty good one. But SuSv3 actually defines the O modifier as causing the locale's alternative numeric symbols to be used, with an example of Roman Numerals. So fractional seconds is probably not quite what "%OS" is intended to do, unless you're in the locale for very fast living people. :-)

In current versions of glibc, the alt_digits field used by the O modifier is only present for a few locales: fa_IR, ja_JP, and or_IN. Still, there are plenty of other numeral systems out there, so I still favor making up a new modifier like "%.S", rather than trading off localisation for precision.