コード例 #1
0
    def convert_timestamp(timestamp):
        date_str = AdcpsJlnStcInstrumentParserDataParticle.unpack_date(timestamp)

        TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"

        dt = datetime.strptime(date_str, TIMESTAMP_FORMAT)

        unix_time = calendar.timegm(dt.timetuple()) + (dt.microsecond / 1000000.0)

        timestamp_converted = ntplib.system_to_ntp_time(unix_time)
        return timestamp_converted
コード例 #2
0
    def convert_timestamp(timestamp):
        date_str = AdcpsJlnStcInstrumentParserDataParticle.unpack_date(
            timestamp)

        TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"

        dt = datetime.strptime(date_str, TIMESTAMP_FORMAT)

        unix_time = calendar.timegm(
            dt.timetuple()) + (dt.microsecond / 1000000.0)

        timestamp_converted = ntplib.system_to_ntp_time(unix_time)
        return timestamp_converted
コード例 #3
0
 def convert_timestamp(timestamp):
     date_str = AdcpsJlnStcInstrumentParserDataParticle.unpack_date(timestamp)
     converted_time = float(parser.parse(date_str).strftime("%s.%f"))
     adjusted_time = converted_time - time.timezone
     timestamp_converted = ntplib.system_to_ntp_time(adjusted_time)
     return timestamp_converted