View Single Post
Old 03-28-2025, 03:12 PM   #232
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 47,125
Karma: 169815798
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For what little it may be worth, here are the two templates I use for the Time Read and Remaining Reading Time with hr:min:sec displayed. Basically a borrow from the original template in message#2 in this thread and chaley's template in the message #820 in the Templates: various questions not worth their own thread thread. My original code wasn't nearly as pretty since I tried using gmtime and strftime in a Python template.

Code:
program:

	total = $#kobo_time_spent_reading;
	hours = floor(total/3600);
	minutes = floor(mod(total, 3600)/60);
	seconds = mod(total, 60);
def format(v, str):
    if v == 0 then return '' fi;
    return v & ' ' & str & ' '
fed;
format(hours, 'hr') & format(minutes, 'min') & format(seconds, 'sec')
Code:
program:

total = $#kobo_rest_of_book_estimate;
	hours = floor(total/3600);
	minutes = floor(mod(total, 3600)/60);
	seconds = mod(total, 60);
def format(v, str):
    if v == 0 then return '' fi;
    return v & ' ' & str & ' '
fed;
format(hours, 'hr') & format(minutes, 'min') & format(seconds, 'sec')
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2025-03-28 121259.png
Views:	56
Size:	17.8 KB
ID:	214703  

Last edited by DNSB; 03-28-2025 at 03:32 PM.
DNSB is offline   Reply With Quote