Time Arithmetic by nn

F={"0$it"[-2,-1]}
System.in.eachLine{(a,b,c,d,e,f)=it.split(/\D/)*.toLong()
c+=f
b+=c>59?e+1:e
println"$it=${F((b>59?a-~d:a+d)%24)}:${F(b%60)}:${F(c%60)}"}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page