assuming local_time is False:
datetime.datetime.strptime(self.time, gpsTimeFormat) will parse the time format string, which is in UTC, and return a datetime object with no timezone info. This naive object will assume that this datetime object was in the local timezone, which is an incorrect assumption--it is in UTC.
Properly adding the tzinfo attribute should prevent the datetime object from being wrong in the local_time = False case.
assuming
local_time
is False:datetime.datetime.strptime(self.time, gpsTimeFormat)
will parse the time format string, which is in UTC, and return adatetime
object with no timezone info. This naive object will assume that this datetime object was in the local timezone, which is an incorrect assumption--it is in UTC. Properly adding thetzinfo
attribute should prevent thedatetime
object from being wrong in thelocal_time = False
case.