Add time conversion utility function