Comment 1 for bug 1086393

Revision history for this message
Olivier Macchioni (olivier-macchioni) wrote :

This helper function can help (assuming the OpenERP server is in the same timezone as the pingen server)

def to_utc_time(time):
    if isinstance(time, (str, unicode)):
        time = datetime.strptime(time, '%Y-%m-%d %H:%M:%S')
    assert isinstance(time, datetime)
    from_zone = tz.tzlocal()
    to_zone = tz.tzutc()
    time = time.replace(tzinfo=from_zone)
    return time.astimezone(to_zone)