예제 #1
0
def test_utc_offset_str():
    tz = environ.get(b'TZ')
    tzset()
    try:
        set_tz(b'FOO+0:00')
        WVPASSEQ(utc_offset_str(0), b'+0000')
        set_tz(b'FOO+1:00')
        WVPASSEQ(utc_offset_str(0), b'-0100')
        set_tz(b'FOO-1:00')
        WVPASSEQ(utc_offset_str(0), b'+0100')
        set_tz(b'FOO+3:3')
        WVPASSEQ(utc_offset_str(0), b'-0303')
        set_tz(b'FOO-3:3')
        WVPASSEQ(utc_offset_str(0), b'+0303')
        # Offset is not an integer number of minutes
        set_tz(b'FOO+3:3:3')
        WVPASSEQ(utc_offset_str(1), b'-0303')
        set_tz(b'FOO-3:3:3')
        WVPASSEQ(utc_offset_str(1), b'+0303')
        WVPASSEQ(utc_offset_str(314159), b'+0303')
    finally:
        if tz:
            set_tz(tz)
        else:
            try:
                set_tz(None)
            except KeyError:
                pass
예제 #2
0
def test_utc_offset_str():
    with no_lingering_errors():
        tz = os.environ.get('TZ')
        try:
            os.environ['TZ'] = 'FOO+0:00'
            WVPASSEQ(utc_offset_str(0), '+0000')
            os.environ['TZ'] = 'FOO+1:00'
            WVPASSEQ(utc_offset_str(0), '-0100')
            os.environ['TZ'] = 'FOO-1:00'
            WVPASSEQ(utc_offset_str(0), '+0100')
            os.environ['TZ'] = 'FOO+3:3'
            WVPASSEQ(utc_offset_str(0), '-0303')
            os.environ['TZ'] = 'FOO-3:3'
            WVPASSEQ(utc_offset_str(0), '+0303')
            # Offset is not an integer number of minutes
            os.environ['TZ'] = 'FOO+3:3:3'
            WVPASSEQ(utc_offset_str(1), '-0303')
            os.environ['TZ'] = 'FOO-3:3:3'
            WVPASSEQ(utc_offset_str(1), '+0303')
            WVPASSEQ(utc_offset_str(314159), '+0303')
        finally:
            if tz:
                os.environ['TZ'] = tz
            else:
                try:
                    del os.environ['TZ']
                except KeyError:
                    pass
예제 #3
0
파일: thelpers.py 프로젝트: 0xkag/bup
def test_utc_offset_str():
    with no_lingering_errors():
        tz = os.environ.get('TZ')
        try:
            os.environ['TZ'] = 'FOO+0:00'
            WVPASSEQ(utc_offset_str(0), '+0000')
            os.environ['TZ'] = 'FOO+1:00'
            WVPASSEQ(utc_offset_str(0), '-0100')
            os.environ['TZ'] = 'FOO-1:00'
            WVPASSEQ(utc_offset_str(0), '+0100')
            os.environ['TZ'] = 'FOO+3:3'
            WVPASSEQ(utc_offset_str(0), '-0303')
            os.environ['TZ'] = 'FOO-3:3'
            WVPASSEQ(utc_offset_str(0), '+0303')
            # Offset is not an integer number of minutes
            os.environ['TZ'] = 'FOO+3:3:3'
            WVPASSEQ(utc_offset_str(1), '-0303')
            os.environ['TZ'] = 'FOO-3:3:3'
            WVPASSEQ(utc_offset_str(1), '+0303')
            WVPASSEQ(utc_offset_str(314159), '+0303')
        finally:
            if tz:
                os.environ['TZ'] = tz
            else:
                try:
                    del os.environ['TZ']
                except KeyError:
                    pass
예제 #4
0
파일: git.py 프로젝트: zzmjohn/bup
def _local_git_date_str(epoch_sec):
    return b'%d %s' % (epoch_sec, utc_offset_str(epoch_sec))
예제 #5
0
파일: git.py 프로젝트: arceduardvincent/bup
def _local_git_date_str(epoch_sec):
    return '%d %s' % (epoch_sec, utc_offset_str(epoch_sec))
예제 #6
0
def _git_date(date):
    return '%d %s' % (date, utc_offset_str(date))
예제 #7
0
파일: git.py 프로젝트: senseb/bup
def _git_date(date):
    return '%d %s' % (date, utc_offset_str(date))