Skip to content

Commit

Permalink
Removed TimestampEvent log2timeline#910
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Jun 24, 2020
1 parent e6004fe commit c8d3a9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 45 deletions.
36 changes: 6 additions & 30 deletions plaso/containers/time_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,29 @@
from plaso.lib import timelib


class TimestampEvent(events.EventObject):
"""Plaso timestamp-based event attribute container.
class DateTimeValuesEvent(events.EventObject):
"""dfDateTime date time values-based event attribute container.
Attributes:
data_type (str): event data type.
timestamp (int): timestamp, which contains the number of microseconds
since January 1, 1970, 00:00:00 UTC.
timestamp_desc (str): description of the meaning of the timestamp.
"""

def __init__(self, timestamp, timestamp_description, data_type=None):
"""Initializes an event.
Args:
timestamp (int): timestamp, which contains the number of microseconds
since January 1, 1970, 00:00:00 UTC.
timestamp_description (str): description of the meaning of the timestamp
value.
data_type (Optional[str]): event data type. If the data type is not set
it is derived from the DATA_TYPE class attribute.
"""
super(TimestampEvent, self).__init__()
self.timestamp = timestamp
self.timestamp_desc = timestamp_description

if data_type:
self.data_type = data_type


class DateTimeValuesEvent(TimestampEvent):
"""dfDateTime date time values-based event attribute container."""

def __init__(
self, date_time, date_time_description, data_type=None, time_zone=None):
self, date_time, date_time_description, time_zone=None):
"""Initializes an event.
Args:
date_time (dfdatetime.DateTimeValues): date and time values.
date_time_description (str): description of the meaning of the date and
time values.
data_type (Optional[str]): event data type. If the data type is not set
it is derived from the DATA_TYPE class attribute.
time_zone (Optional[datetime.tzinfo]): time zone.
"""
timestamp = date_time.GetPlasoTimestamp()
if date_time.is_local_time and time_zone:
timestamp = timelib.Timestamp.LocaltimeToUTC(timestamp, time_zone)

super(DateTimeValuesEvent, self).__init__(
timestamp, date_time_description, data_type=data_type)
super(DateTimeValuesEvent, self).__init__()
self.timestamp = timestamp
self.timestamp_desc = date_time_description
15 changes: 0 additions & 15 deletions tests/containers/time_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@
from tests import test_lib as shared_test_lib


class TimestampEventTest(shared_test_lib.BaseTestCase):
"""Tests for the Plaso timestamp-based event attribute container."""

def testGetAttributeNames(self):
"""Tests the GetAttributeNames function."""
attribute_container = time_events.TimestampEvent(0, 'usage')

expected_attribute_names = [
'_event_data_row_identifier', 'parser', 'timestamp', 'timestamp_desc']

attribute_names = sorted(attribute_container.GetAttributeNames())

self.assertEqual(attribute_names, expected_attribute_names)


class DateTimeValuesEventTest(shared_test_lib.BaseTestCase):
"""Tests for the dfDateTime-based event attribute container."""

Expand Down

0 comments on commit c8d3a9c

Please sign in to comment.