Time Arithmetic by Hjulle

import Text.Printf\x0d
add v=printf "%s=%02d:%02d:%02d\n" v h m s where(h1:m1:s1:h2:m2:s2:_)=n v::[Int];(m3,s)=divMod(s1+s2)60;(h3,m)=divMod(m1+m2+m3)60;h=mod(h1+h2+h3)24\x0d
n (d:e:l)=read[d,e]:(n$tail l)\x0d
m@main=getLine>>=add>>m

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

download

return to the top page