Convert seconds to compound duration: Difference between revisions
Content added Content deleted
m (tiny clarification) |
|||
Line 83: | Line 83: | ||
Demonstration: |
Demonstration: |
||
<lang perl>for (7259, 86400, 6000000) { |
<lang perl>for (7259, 86400, 6000000) { |
||
printf "%7d |
printf "%7d sec = %s\n", $_, compound_duration($_) |
||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
7259 |
7259 sec = 2 hr, 59 sec |
||
86400 |
86400 sec = 1 d |
||
6000000 |
6000000 sec = 9 wk, 6 d, 10 hr, 40 min |
||
</pre> |
</pre> |
||
Line 104: | Line 104: | ||
Demonstration: |
Demonstration: |
||
<lang perl6>for 7259, 86400, 6000000 { |
<lang perl6>for 7259, 86400, 6000000 { |
||
say "{.fmt: '%7d'} |
say "{.fmt: '%7d'} sec = {compound-duration $_}"; |
||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
7259 |
7259 sec = 2 hr, 59 sec |
||
86400 |
86400 sec = 1 d |
||
6000000 |
6000000 sec = 9 wk, 6 d, 10 hr, 40 min |
||
</pre> |
</pre> |