Time cannot be negative
Improve time_to_s function