Quote:
Originally Posted by DNSB
Sadly, I am now trying to create a template to translate a reading time of 7619 for example.
|
Probably there's a more elegant way, but it seems to work:
Code:
program:
tot_seconds = $#readingtime;
hours = floor(tot_seconds/3600);
minutes = floor((tot_seconds-hours*3600)/60);
seconds = tot_seconds - hours*3600 - minutes*60;
def to_plural(v, str):
if v == 0 then return '' fi;
return v & ' ' & str & ' '
fed;
to_plural(hours, 'hr') & to_plural(minutes, 'min') & to_plural(seconds, 'sec')