$duration($ctime) is around that figure, so presumably you're not subtracting the correct value from it.