tracktable.core.simple_timezone module

Module contents

simple_timezone - Timezone struct based on UTC offset

class tracktable.core.simple_timezone.SimpleTimeZone(hours=0, minutes=0, name='UTC')[source]

Bases: tzinfo

Trivial time zone struct for use with datetime.

We use this when we don’t need the full power of the pytz package.

offset

Offset from UTC

Type:

datetime.timedelta

name

Human-readable name for timezone

Type:

str

dst(dt)[source]

Return daylight savings time offset

Since we don’t support daylight savings time in SimpleTimeZone this is always zero.

Parameters:

dt (datetime.datetime) – Timestamp to check for DST

Returns:

Zero time offset

localize(timestamp)[source]

Convert a datetime into an ‘aware’ datetime object by replacing its time zone

Parameters:

timestamp (datetime.datetime) – Timestamp object to make aware

Returns:

New datetime.datetime object with this timezone attached

utcoffset(dt)[source]

Return offset from UTC

This method is required by the Python datetime library in order to create ‘aware’ datetime objects.

Parameters:

dt (datetime.timedelta) – Not used