8 lines
544 B
Text
8 lines
544 B
Text
tim := proc (s) local weeks, days, hours, minutes, seconds;
|
|
weeks := trunc((1/604800)*s);
|
|
days := trunc((1/86400)*s)-7*weeks;
|
|
hours := trunc((1/3600)*s)-24*days-168*weeks;
|
|
minutes := trunc((1/60)*s)-60*hours-1440*days-10080*weeks;
|
|
seconds := s-60*minutes-3600*hours-86400*days-604800*weeks;
|
|
printf("%s", cat(`if`(0 < weeks, cat(weeks, "wk, "), NULL), `if`(0 < days, cat(days, "d, "), NULL), `if`(0 < hours, cat(hours, "hr, "), NULL), `if`(0 < minutes, cat(minutes, "min, "), NULL), `if`(0 < seconds, cat(seconds, "sec"), NULL)))
|
|
end proc;
|