cast time values correctly when converting to milliseconds