Protected format_time against empty values