On Wed, Oct 12, 2011 at 08:26:15PM -0700, Alex Nelson wrote:
- if (strftime (ret, TIMESTAMP_BUF_LEN, "%FT%TZ", tm) == 0) { + if (strftime (ret, TIMESTAMP_BUF_LEN, "%FT%T", tm) == 0) {
It turns out there's a better way to do this (which I didn't know about either -- thanks Jim Meyering). Using the gnulib strftime replacement function, you can use %N for nanoseconds, and you can also use a number in front to get the required precision. gnulib strftime is the same function that (GNU) date uses, hence you can try it out: $ date '+%T.%3N' ; date '+%T.%N' 14:25:27.840 14:25:27.842204825 The gnulib {,n}strftime function takes extra parameters, one of which carries the nanosecond value (ns). Have a look at hivex.git/.gnulib/tests/test-strftime.c to see an example. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v