def _strftime(pattern, time_struct=time.localtime()):
    """Custom strftime because Windows is shit again.
    """
    try:
        return time.strftime(pattern, time_struct)
    except OSError:
        dt = datetime.datetime.fromtimestamp(_mktime(time_struct))
        # This is incredibly hacky and will probably break with leap
        # year overlaps and shit. Any complaints should go here:
        # https://support.microsoft.com/
        original = dt.year
        current = datetime.datetime.now().year
        dt = dt.replace(year=current)
        ts = dt.timestamp()
        if _isdst(dt):
            ts -= 3600
        string = time.strftime(pattern, time.localtime(ts))
        string = string.replace(str(current), str(original))
        return string
def _strftime ( pattern , time_struct = time . localtime ( ) ) : try : return time . strftime ( pattern , time_struct ) except OSError : dt = datetime . datetime . fromtimestamp ( _mktime ( time_struct ) ) original = dt . year current = datetime . datetime . now ( ) . year dt = dt . replace ( year = current ) ts = dt . timestamp ( ) if _isdst ( dt ) : ts -= 3600 string = time . strftime ( pattern , time . localtime ( ts ) ) string = string . replace ( str ( current ) , str ( original ) ) return string
Custom strftime because Windows is shit again.