return error instead of panic when type of time != float