All pastes #32992 Raw Edit

Unnamed

public text v1 · immutable
#32992 ·published 2005-12-08 17:29 UTC
rendered paste body
alias ugly.seconds.converter {
  if ($1 < 60) { 
    return $+($1,s) 
  }
  elseif ($1 < 3600) { 
    set -u0 %minutes $gettok($calc($1 / 60),1,46)
    set -u0 %seconds $calc($1 - (60 * %minutes))
    return $+(%minutes,m,$chr(32),%seconds,s) 
  }
  else { 
    set -u0 %hours $gettok($calc($1 / 3600),1,46)
    set -u0 %minutes $gettok($calc(($1 - (3600 * %hours)) / 60),1,46)
    set -u0 %seconds $calc($1 - (3600 * %hours) - (60 * %minutes))
    return $+(%hours,h,$chr(32),%minutes,m,$chr(32),%seconds,s)
  }
}