コード例 #1
0
def variant_time_to_datetime(vtime):
    """
    Converts a variant time (OLE date/time) to a Python datetime object.

    :parameters:
        vtime
            The time in OLE date format.

    :raises:
        ValueError
            If vtime is an invalid value.

    :rtype: datetime
    :returns: The time as a Python datetime object.
    """
    return VariantTimeTodatetime.from_float(vtime)
コード例 #2
0
ファイル: time.py プロジェクト: KrestMoraes/libforensics
def variant_time_to_datetime(vtime):
    """
    Converts a variant time (OLE date/time) to a Python datetime object.

    :parameters:
        vtime
            The time in OLE date format.

    :raises:
        ValueError
            If vtime is an invalid value.

    :rtype: datetime
    :returns: The time as a Python datetime object.
    """
    return VariantTimeTodatetime.from_float(vtime)
コード例 #3
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
コード例 #4
0
ファイル: time.py プロジェクト: KrestMoraes/libforensics
    def test_from_float(self):
        ae = self.assertEqual

        value = VariantTimeTodatetime.from_float(3.25)
        ae(value, datetime(1900, 1, 2, 6, 0, 0))
コード例 #5
0
ファイル: time.py プロジェクト: pombreda/libforensics
    def test_from_float(self):
        ae = self.assertEqual

        value = VariantTimeTodatetime.from_float(3.25)
        ae(value, datetime(1900, 1, 2, 6, 0, 0))