I'd like to be able to write a time string that looks like this: 1:04:02.1 hours
using printf.
When I try to write something like this:
printf("%d:%02d:%02.1f hours
", 1, 4, 2.123456);
I get:
1:04:2.1 hours
Is it possible to add leading zeros to a float formatting?
See Question&Answers more detail:os