Added time conversion code