def current_time(): ts = time.time() return datetime.fromtimestamp(ts).strftime(TIME_FORMAT) # converts a string to a timestamp