Added validation and autocorrection of time