def patched_get_utc_now(timezone=None):
"""Return the current UTC time.
:param timezone: an optional timezone param to offset time to.
"""
utc_datetime = pytz.utc.localize(datetime.datetime.utcnow())
if timezone is not None:
try: utc_datetime = utc_datetime.astimezone(pytz.timezone(timezone))
except Exception as e: _LOG.exception('Error translating timezones: %s ', e)
monkey patch:
def patched_ get_utc_ now(timezone= None):
"""Return the current UTC time.
:param timezone: an optional timezone param to offset time to. localize( datetime. datetime. utcnow( ))
utc_ datetime = utc_datetime. astimezone( pytz.timezone( timezone) )
_LOG. exception( 'Error translating timezones: %s ', e)
"""
utc_datetime = pytz.utc.
if timezone is not None:
try:
except Exception as e:
return utc_datetime. isoformat( )
# monkey patch pycadfs flawed timestamp formatter timestamp. get_utc_ now = patched_get_utc_now
pycadf.