Project

General

Profile

Bug #4615 » 0001-Corrected-wrong-DST-calculations-in-the-Warden-clien.patch

Daniel Studený, 02/04/2020 04:32 PM

View differences:

warden3/warden_client/warden_client.py
645 645

  
646 646

  
647 647
def format_timestamp(epoch=None, utc=True, utcoffset=None):
648
    if utcoffset is None:
649
        utcoffset = -(time.altzone if time.daylight else time.timezone)
650 648
    if epoch is None:
651 649
        epoch = time.time()
650
    if utcoffset is None:
651
        utcoffset = -(time.altzone if time.daylight and time.localtime(epoch)[-1] else time.timezone)
652 652
    if utc:
653 653
        epoch += utcoffset
654 654
    us = int(epoch % 1 * 1000000 + 0.5)
655 655
    return format_time(*time.gmtime(epoch)[:6], microsec=us, utcoffset=utcoffset)
656 656

  
657

  
658 657
def format_time(year, month, day, hour, minute, second, microsec=0, utcoffset=None):
659 658
    if utcoffset is None:
660 659
        utcoffset = -(time.altzone if time.daylight else time.timezone)
    (1-1/1)