Is %f formatting broken?

Yep! … I should have known that all the way back from my FORTRAN days…
My faith in {humanity|Ruby} has been restored.

···

sprintf (“%d days %02d:%02d:%02.6f”,@DD,@hh,@mm,@ss)
produces:
537 days 22:05:10.081386 until Teddy gets his learner’s permit
537 days 22:05:9.081456 until Teddy gets his learner’s permit

I intended for the seconds to be right-justified and zero-filled.

The ‘.6’ part is the number of digits past the decimal point.
The ‘02’ is the width of the entire field.

Thus what you’re wanting is:

%09.6f

% ruby -e ‘printf “x%09.6fx\n”, 9.081456’
x09.081456x

cheers,

Iain.