Thanks to @cweitkamp as I looked for something like this not long ago and it helped me today. Nevertheless I would like to further elaborate the topic by adding a few details:
First of all, install the Javascript Transformation via Paper UI.
kodi.items
Number:Time myKodi_currenttime "Current Time [JS(uptime.js):%s]" { channel="kodi:kodi:myKodi:currenttime" }
Number:Time myKodi_duration "Duration [JS(uptime.js):%s]" { channel="kodi:kodi:myKodi:duration" }
uptime.js
(put into transform
folder; all credits go to @KjetilA for his code; I have added the missing seconds to it and simplified it a bit )
(function(seconds) {
var retval = "";
var days = Math.floor(seconds / (24 * 60 * 60));
seconds = seconds % (24 * 60 * 60);
var hours = Math.floor(seconds / (60 * 60));
seconds = seconds % (60 * 60);
var minutes = Math.floor(seconds / 60);
seconds = seconds % 60;
if (days > 0) {
retval += days + " day";
if (days > 1) {
retval += "s";
}
retval += " ";
}
retval += hours + ":";
if (minutes < 10) {
retval += "0";
}
retval += minutes + ":";
if (seconds < 10) {
retval += "0";
}
retval += seconds;
return retval;
})(input);
I hope this helps. Of course there is a quite compact version of it as well (thanks to @Olymp; also without seconds).