Commit 33e7215c authored by Hilko Bengen's avatar Hilko Bengen

New upstream version 20180510

parent 3af4516e
dfdatetime (20180509-1) unstable; urgency=low
dfdatetime (20180510-1) unstable; urgency=low
* Auto-generated
-- Log2Timeline <log2timeline-dev@googlegroups.com> Wed, 09 May 2018 07:07:06 +0200
\ No newline at end of file
-- Log2Timeline <log2timeline-dev@googlegroups.com> Thu, 10 May 2018 10:18:44 +0200
\ No newline at end of file
......@@ -5,4 +5,4 @@ dfDateTime, or Digital Forensics date and time, provides date and time
objects to preserve accuracy and precision.
"""
__version__ = '20180509'
__version__ = '20180510'
......@@ -123,20 +123,3 @@ class CocoaTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:06d}'.format(
year, month, day_of_month, hours, minutes, seconds, microseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self.timestamp is None:
return None, None, None
try:
number_of_days, _, _, _ = self._GetTimeValues(int(self.timestamp))
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -133,21 +133,3 @@ class DelphiDateTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:06d}'.format(
year, month, day_of_month, hours, minutes, seconds, microseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self.timestamp is None:
return None, None, None
try:
number_of_seconds = self.timestamp * definitions.SECONDS_PER_DAY
number_of_days, _, _, _ = self._GetTimeValues(int(number_of_seconds))
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -104,20 +104,3 @@ class FakeTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:06d}'.format(
year, month, day_of_month, hours, minutes, seconds,
self._microseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self._number_of_seconds is None:
return None, None, None
try:
number_of_days, _, _, _ = self._GetTimeValues(self._number_of_seconds)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -172,20 +172,3 @@ class FATDateTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}'.format(
year, month, day_of_month, hours, minutes, seconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self._number_of_seconds is None:
return None, None, None
try:
number_of_days, _, _, _ = self._GetTimeValues(self._number_of_seconds)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -125,22 +125,3 @@ class Filetime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:07d}'.format(
year, month, day_of_month, hours, minutes, seconds, remainder)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if (self.timestamp is None or self.timestamp < 0 or
self.timestamp > self._UINT64_MAX):
return None, None, None
try:
timestamp, _ = divmod(self.timestamp, self._100NS_PER_SECOND)
number_of_days, _, _, _ = self._GetTimeValues(timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -117,21 +117,3 @@ class HFSTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}'.format(
year, month, day_of_month, hours, minutes, seconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if (self.timestamp is None or self.timestamp < 0 or
self.timestamp > self._UINT32_MAX):
return None, None, None
try:
number_of_days, _, _, _ = self._GetTimeValues(self.timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -32,6 +32,14 @@ class DateTimeEpoch(object):
self.year = year
class NormalizedTimeEpoch(DateTimeEpoch):
"""dfDateTime normalized time epoch."""
def __init__(self):
"""Initializes a dfDateTime normalized time epoch."""
super(NormalizedTimeEpoch, self).__init__(1970, 1, 1)
class DateTimeValues(object):
"""Date and time values interface.
......@@ -43,6 +51,8 @@ class DateTimeValues(object):
_DAYS_PER_MONTH = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
_EPOCH_NORMALIZED_TIME = NormalizedTimeEpoch()
_100NS_PER_SECOND = 10000000
_100NS_PER_DECISECOND = 1000000
_100NS_PER_MILLISECOND = 10000
......@@ -509,14 +519,17 @@ class DateTimeValues(object):
of bounds.
"""
if epoch_year < 0:
raise ValueError('Epoch year value out of bounds.')
raise ValueError('Epoch year value: {0:d} out of bounds.'.format(
epoch_year))
if epoch_month not in range(1, 13):
raise ValueError('Epoch month value out of bounds.')
raise ValueError('Epoch month value: {0:d} out of bounds.'.format(
epoch_month))
epoch_days_per_month = self._GetDaysPerMonth(epoch_year, epoch_month)
if epoch_day_of_month < 1 or epoch_day_of_month > epoch_days_per_month:
raise ValueError('Epoch day of month value out of bounds.')
raise ValueError('Epoch day of month value: {0:d} out of bounds.'.format(
epoch_day_of_month))
before_epoch = number_of_days < 0
......@@ -770,11 +783,12 @@ class DateTimeValues(object):
"""Determines time values.
Args:
number_of_seconds (int): number of seconds.
number_of_seconds (int|decimal.Decimal): number of seconds.
Returns:
tuple[int, int, int, int]: days, hours, minutes, seconds.
"""
number_of_seconds = int(number_of_seconds)
number_of_minutes, seconds = divmod(number_of_seconds, 60)
number_of_hours, minutes = divmod(number_of_minutes, 60)
number_of_days, hours = divmod(number_of_hours, 24)
......@@ -871,7 +885,6 @@ class DateTimeValues(object):
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######"
"""
@abc.abstractmethod
def GetDate(self):
"""Retrieves the date represented by the date and time values.
......@@ -879,6 +892,18 @@ class DateTimeValues(object):
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
normalized_timestamp = self._GetNormalizedTimestamp()
if normalized_timestamp is None:
return None, None, None
number_of_days, _, _, _ = self._GetTimeValues(normalized_timestamp)
try:
return self._GetDateValuesWithEpoch(
number_of_days, self._EPOCH_NORMALIZED_TIME)
except ValueError:
return None, None, None
# TODO: remove this method when there is no more need for it in plaso.
def GetPlasoTimestamp(self):
......@@ -894,3 +919,17 @@ class DateTimeValues(object):
normalized_timestamp *= definitions.MICROSECONDS_PER_SECOND
return int(round(normalized_timestamp))
def GetTimeOfDay(self):
"""Retrieves the time of day represented by the date and time values.
Returns:
tuple[int, int, int]: hours, minutes, seconds or (None, None, None)
if the date and time values do not represent a time of day.
"""
normalized_timestamp = self._GetNormalizedTimestamp()
if normalized_timestamp is None:
return None, None, None
_, hours, minutes, seconds = self._GetTimeValues(normalized_timestamp)
return hours, minutes, seconds
......@@ -114,22 +114,3 @@ class JavaTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:03d}'.format(
year, month, day_of_month, hours, minutes, seconds, milliseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if (self.timestamp is None or self.timestamp < self._INT64_MIN or
self.timestamp > self._INT64_MAX):
return None, None, None
try:
timestamp, _ = divmod(self.timestamp, definitions.MILLISECONDS_PER_SECOND)
number_of_days, _, _, _ = self._GetTimeValues(timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -130,21 +130,3 @@ class OLEAutomationDate(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:06d}'.format(
year, month, day_of_month, hours, minutes, seconds, microseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self.timestamp is None:
return None, None, None
try:
timestamp = self.timestamp * definitions.SECONDS_PER_DAY
number_of_days, _, _, _ = self._GetTimeValues(int(timestamp))
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -108,23 +108,6 @@ class PosixTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}'.format(
year, month, day_of_month, hours, minutes, seconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self.timestamp is None:
return None, None, None
try:
number_of_days, _, _, _ = self._GetTimeValues(self.timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
class PosixTimeInMicroseconds(interface.DateTimeValues):
"""POSIX timestamp in microseconds.
......@@ -218,21 +201,3 @@ class PosixTimeInMicroseconds(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:06d}'.format(
year, month, day_of_month, hours, minutes, seconds, microseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self.timestamp is None:
return None, None, None
try:
timestamp, _ = divmod(self.timestamp, definitions.MICROSECONDS_PER_SECOND)
number_of_days, _, _, _ = self._GetTimeValues(timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -202,15 +202,3 @@ class RFC2579DateTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:01d}'.format(
self.year, self.month, self.day_of_month, self.hours, self.minutes,
self.seconds, self.deciseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self._number_of_seconds is None:
return None, None, None
return self.year, self.month, self.day_of_month
......@@ -181,15 +181,6 @@ class SemanticTime(interface.DateTimeValues):
"""
return None, None
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
return None, None, None
def GetPlasoTimestamp(self):
"""Retrieves a timestamp that is compatible with plaso.
......
......@@ -184,15 +184,3 @@ class Systemtime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:03d}'.format(
self.year, self.month, self.day_of_month, self.hours, self.minutes,
self.seconds, self.milliseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self._number_of_seconds is None:
return None, None, None
return self.year, self.month, self.day_of_month
......@@ -410,20 +410,6 @@ class TimeElements(interface.DateTimeValues):
self._time_elements_tuple[2], self._time_elements_tuple[3],
self._time_elements_tuple[4], self._time_elements_tuple[5])
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if self._number_of_seconds is None:
return None, None, None
return (
self._time_elements_tuple[0], self._time_elements_tuple[1],
self._time_elements_tuple[2])
class TimeElementsWithFractionOfSecond(TimeElements):
"""Time elements with a fraction of second interface.
......
......@@ -130,22 +130,3 @@ class UUIDTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:07d}'.format(
year, month, day_of_month, hours, minutes, seconds, remainder)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if (self.timestamp is None or self.timestamp < 0 or
self.timestamp > self._UINT60_MAX):
return None, None, None
try:
timestamp, _ = divmod(self.timestamp, self._100NS_PER_SECOND)
number_of_days, _, _, _ = self._GetTimeValues(timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -119,22 +119,3 @@ class WebKitTime(interface.DateTimeValues):
return '{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:06d}'.format(
year, month, day_of_month, hours, minutes, seconds, microseconds)
def GetDate(self):
"""Retrieves the date represented by the date and time values.
Returns:
tuple[int, int, int]: year, month, day of month or (None, None, None)
if the date and time values do not represent a date.
"""
if (self.timestamp is None or self.timestamp < self._INT64_MIN or
self.timestamp > self._INT64_MAX):
return None, None, None
try:
timestamp, _ = divmod(self.timestamp, definitions.MICROSECONDS_PER_SECOND)
number_of_days, _, _, _ = self._GetTimeValues(timestamp)
return self._GetDateValuesWithEpoch(number_of_days, self._EPOCH)
except ValueError:
return None, None, None
......@@ -50,27 +50,27 @@ class CocoaTimeTest(unittest.TestCase):
expected_timestamp = 394934400.0
cocoa_time_object.CopyFromDateTimeString('2013-07-08')
self.assertEqual(cocoa_time_object.timestamp, expected_timestamp)
self.assertEqual(cocoa_time_object._timestamp, expected_timestamp)
expected_timestamp = 395011845.0
cocoa_time_object.CopyFromDateTimeString('2013-07-08 21:30:45')
self.assertEqual(cocoa_time_object.timestamp, expected_timestamp)
self.assertEqual(cocoa_time_object._timestamp, expected_timestamp)
expected_timestamp = 395011845.546875
cocoa_time_object.CopyFromDateTimeString('2013-07-08 21:30:45.546875')
self.assertEqual(cocoa_time_object.timestamp, expected_timestamp)
self.assertEqual(cocoa_time_object._timestamp, expected_timestamp)
expected_timestamp = 395015445.546875
cocoa_time_object.CopyFromDateTimeString('2013-07-08 21:30:45.546875-01:00')
self.assertEqual(cocoa_time_object.timestamp, expected_timestamp)
self.assertEqual(cocoa_time_object._timestamp, expected_timestamp)
expected_timestamp = 395008245.546875
cocoa_time_object.CopyFromDateTimeString('2013-07-08 21:30:45.546875+01:00')
self.assertEqual(cocoa_time_object.timestamp, expected_timestamp)
self.assertEqual(cocoa_time_object._timestamp, expected_timestamp)
expected_timestamp = 86400.0
cocoa_time_object.CopyFromDateTimeString('2001-01-02 00:00:00')
self.assertEqual(cocoa_time_object.timestamp, expected_timestamp)
self.assertEqual(cocoa_time_object._timestamp, expected_timestamp)
def testCopyToDateTimeString(self):
"""Tests the CopyToDateTimeString function."""
......@@ -79,6 +79,14 @@ class CocoaTimeTest(unittest.TestCase):
date_time_string = cocoa_time_object.CopyToDateTimeString()
self.assertEqual(date_time_string, '2013-07-08 21:30:45.546875')
epoch_year = cocoa_time_object._EPOCH.year
cocoa_time_object._EPOCH.year = -1
with self.assertRaises(ValueError):
cocoa_time_object.CopyToDateTimeString()
cocoa_time_object._EPOCH.year = epoch_year
cocoa_time_object = cocoa_time.CocoaTime()
date_time_string = cocoa_time_object.CopyToDateTimeString()
......@@ -91,11 +99,6 @@ class CocoaTimeTest(unittest.TestCase):
date_tuple = cocoa_time_object.GetDate()
self.assertEqual(date_tuple, (2013, 7, 8))
cocoa_time_object._EPOCH.year = -1
date_tuple = cocoa_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
cocoa_time_object = cocoa_time.CocoaTime()
date_tuple = cocoa_time_object.GetDate()
......@@ -114,6 +117,18 @@ class CocoaTimeTest(unittest.TestCase):
micro_posix_timestamp = cocoa_time_object.GetPlasoTimestamp()
self.assertIsNone(micro_posix_timestamp)
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
cocoa_time_object = cocoa_time.CocoaTime(timestamp=395011845.546875)
time_of_day_tuple = cocoa_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (21, 30, 45))
cocoa_time_object = cocoa_time.CocoaTime()
time_of_day_tuple = cocoa_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
unittest.main()
......@@ -135,15 +135,23 @@ class DelphiDateTimeTest(unittest.TestCase):
date_tuple = delphi_date_time_object.GetDate()
self.assertEqual(date_tuple, (2013, 6, 18))
delphi_date_time_object._EPOCH.year = -1
delphi_date_time_object = delphi_date_time.DelphiDateTime()
date_tuple = delphi_date_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
delphi_date_time_object = delphi_date_time.DelphiDateTime(
timestamp=41443.8263953)
time_of_day_tuple = delphi_date_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (19, 50, 0))
delphi_date_time_object = delphi_date_time.DelphiDateTime()
date_tuple = delphi_date_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
time_of_day_tuple = delphi_date_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
......
......@@ -90,15 +90,25 @@ class FakeTimeTest(unittest.TestCase):
date_tuple = fake_time_object.GetDate()
self.assertEqual(date_tuple, (2010, 8, 12))
fake_time_object._EPOCH.year = -1
fake_time_object = fake_time.FakeTime()
fake_time_object._number_of_seconds = None
date_tuple = fake_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
fake_time_object = fake_time.FakeTime()
fake_time_object.CopyFromDateTimeString('2010-08-12 21:06:31.546875')
date_tuple = fake_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
time_of_day_tuple = fake_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (21, 6, 31))
fake_time_object = fake_time.FakeTime()
fake_time_object._number_of_seconds = None
time_of_day_tuple = fake_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
......
......@@ -124,15 +124,22 @@ class FATDateTime(unittest.TestCase):
date_tuple = fat_date_time_object.GetDate()
self.assertEqual(date_tuple, (2010, 8, 12))
fat_date_time_object._EPOCH.year = -1
fat_date_time_object = fat_date_time.FATDateTime()
date_tuple = fat_date_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
fat_date_time_object = fat_date_time.FATDateTime(fat_date_time=0xa8d03d0c)
time_of_day_tuple = fat_date_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (21, 6, 32))
fat_date_time_object = fat_date_time.FATDateTime()
date_tuple = fat_date_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
time_of_day_tuple = fat_date_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
......
......@@ -98,15 +98,22 @@ class FiletimeTest(unittest.TestCase):
date_tuple = filetime_object.GetDate()
self.assertEqual(date_tuple, (2010, 8, 12))
filetime_object._EPOCH.year = -1
filetime_object = filetime.Filetime()
date_tuple = filetime_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
filetime_object = filetime.Filetime(timestamp=0x01cb3a623d0a17ce)
time_of_day_tuple = filetime_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (21, 6, 31))
filetime_object = filetime.Filetime()
date_tuple = filetime_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
time_of_day_tuple = filetime_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
......
......@@ -103,15 +103,22 @@ class HFSTimeTest(unittest.TestCase):
date_tuple = hfs_time_object.GetDate()
self.assertEqual(date_tuple, (2013, 8, 1))
hfs_time_object._EPOCH.year = -1
hfs_time_object = hfs_time.HFSTime()
date_tuple = hfs_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
hfs_time_object = hfs_time.HFSTime(timestamp=3458215528)
time_of_day_tuple = hfs_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (15, 25, 28))
hfs_time_object = hfs_time.HFSTime()
date_tuple = hfs_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
time_of_day_tuple = hfs_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
......
......@@ -82,15 +82,22 @@ class JavaTimeTest(unittest.TestCase):
date_tuple = java_time_object.GetDate()
self.assertEqual(date_tuple, (2010, 8, 12))
java_time_object._EPOCH.year = -1
java_time_object = java_time.JavaTime()
date_tuple = java_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
java_time_object = java_time.JavaTime(timestamp=1281643591546)
time_of_day_tuple = java_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (20, 6, 31))
java_time_object = java_time.JavaTime()
date_tuple = java_time_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
time_of_day_tuple = java_time_object.GetTimeOfDay()
self.assertEqual(time_of_day_tuple, (None, None, None))
if __name__ == '__main__':
......
......@@ -100,15 +100,23 @@ class OLEAutomationDateTest(unittest.TestCase):
date_tuple = ole_automation_date_object.GetDate()
self.assertEqual(date_tuple, (2017, 11, 5))
ole_automation_date_object._EPOCH.year = -1
ole_automation_date_object = ole_automation_date.OLEAutomationDate()
date_tuple = ole_automation_date_object.GetDate()
self.assertEqual(date_tuple, (None, None, None))
def testGetTimeOfDay(self):
"""Tests the GetTimeOfDay function."""
ole_automation_date_object = ole_automation_date.OLEAutomationDate(