コード例 #1
0
def convert_timestamp(timestamp, timestamp_type):
    """Converts a timestamp from an integer into a datetime object."""

    if timestamp_type == "posix":
        new_timestamp = POSIXTimeTodatetime.from_int(timestamp)

    elif timestamp_type == "dosdate":
        new_timestamp = DOSDateTimeTodatetime.from_ints(timestamp, None).date()

    elif timestamp_type == "dostime":
        new_timestamp = DOSDateTimeTodatetime.from_ints(None, timestamp).time()

    elif timestamp_type == "filetime":
        new_timestamp = FILETIMETodatetime.from_int(timestamp)

    elif timestamp_type == "variant":
        new_timestamp = VariantTimeTodatetime.from_float(timestamp)

    else:
        raise ValueError("Unknown timestamp type: {0}".format(timestamp_type))
    # end if

    return new_timestamp
コード例 #2
0
ファイル: time.py プロジェクト: KrestMoraes/libforensics
    def test_from_int(self):
        ae = self.assertEqual

        control_datetime = datetime(2002, 11, 27, 3, 25, 0)
        ae(POSIXTimeTodatetime.from_int(0x3DE43B0C), control_datetime)
コード例 #3
0
ファイル: time.py プロジェクト: pombreda/libforensics
    def test_from_int(self):
        ae = self.assertEqual

        control_datetime = datetime(2002, 11, 27, 3, 25, 0)
        ae(POSIXTimeTodatetime.from_int(0x3DE43B0C), control_datetime)