View Single Post
Old 01-20-2025, 03:48 PM   #3183
Lys
Groupie
Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.
 
Posts: 167
Karma: 727278
Join Date: Dec 2022
Location: Not in an English speaking country
Device: (Too many) Kobo(s)
Quote:
Originally Posted by DNSB View Post
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')

Last edited by Lys; 01-20-2025 at 03:52 PM.
Lys is offline