Implement a new time_str2secs() function with clean code.