Commit 8fb4b936 authored by Hilko Bengen's avatar Hilko Bengen

New upstream version 20180606

parent 33e7215c
dfdatetime (20180510-1) unstable; urgency=low
dfdatetime (20180606-1) unstable; urgency=low
* Auto-generated
-- Log2Timeline <log2timeline-dev@googlegroups.com> Thu, 10 May 2018 10:18:44 +0200
\ No newline at end of file
-- Log2Timeline <log2timeline-dev@googlegroups.com> Wed, 06 Jun 2018 07:13:41 +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__ = '20180510'
__version__ = '20180606'
......@@ -107,7 +107,8 @@ class CocoaTime(interface.DateTimeValues):
"""Copies the Cocoa timestamp to a date and time string.
Returns:
str: date and time value formatted as: YYYY-MM-DD hh:mm:ss.######
str: date and time value formatted as: YYYY-MM-DD hh:mm:ss.###### or
None if the timestamp cannot be copied to a date and time string.
"""
if self._timestamp is None:
return None
......
......@@ -882,9 +882,23 @@ class DateTimeValues(object):
"""Copies the date time value to a date and time string.
Returns:
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######"
str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or
None if the timestamp cannot be copied to a date and time string.
"""
def CopyToDateTimeStringISO8601(self):
"""Copies the date time value to an ISO 8601 date and time string.
Returns:
str: date and time value formatted as an ISO 8601 date and time string or
None if the timestamp cannot be copied to a date and time string.
"""
date_time_string = self.CopyToDateTimeString()
if date_time_string:
date_time_string = date_time_string.replace(' ', 'T')
date_time_string = '{0:s}Z'.format(date_time_string)
return date_time_string
def GetDate(self):
"""Retrieves the date represented by the date and time values.
......
......@@ -24,7 +24,7 @@ class RFC2579DateTime(interface.DateTimeValues):
uint8_t deciseconds,
char direction_from_utc,
uint8_t hours_from_utc,
uint8_t minuted_from_utc
uint8_t minutes_from_utc
}
Also see:
......
......@@ -172,6 +172,16 @@ class SemanticTime(interface.DateTimeValues):
"""
return self._string
def CopyToDateTimeStringISO8601(self):
"""Copies the date time value to an ISO 8601 date and time string.
Returns:
str: date and time value formatted as an ISO 8601 date and time string,
which always be None since semantic time cannot be represented in
ISO 8601.
"""
return None
def CopyToStatTimeTuple(self):
"""Copies the semantic timestamp to a stat timestamp tuple.
......
......@@ -92,6 +92,13 @@ class CocoaTimeTest(unittest.TestCase):
date_time_string = cocoa_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
cocoa_time_object = cocoa_time.CocoaTime(timestamp=395011845.546875)
date_time_string = cocoa_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2013-07-08T21:30:45.546875Z')
def testGetDate(self):
"""Tests the GetDate function."""
cocoa_time_object = cocoa_time.CocoaTime(timestamp=395011845.546875)
......
......@@ -127,6 +127,14 @@ class DelphiDateTimeTest(unittest.TestCase):
date_time_string = delphi_date_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
delphi_date_time_object = delphi_date_time.DelphiDateTime(
timestamp=41443.8263953)
date_time_string = delphi_date_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2013-06-18T19:50:00.553919Z')
def testGetDate(self):
"""Tests the GetDate function."""
delphi_date_time_object = delphi_date_time.DelphiDateTime(
......
......@@ -82,6 +82,14 @@ class FakeTimeTest(unittest.TestCase):
date_time_string = fake_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
fake_time_object = fake_time.FakeTime()
fake_time_object.CopyFromDateTimeString('2010-08-12 21:06:31.546875')
date_time_string = fake_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T21:06:31.546875Z')
def testGetDate(self):
"""Tests the GetDate function."""
fake_time_object = fake_time.FakeTime()
......
......@@ -117,6 +117,13 @@ class FATDateTime(unittest.TestCase):
date_time_string = fat_date_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
fat_date_time_object = fat_date_time.FATDateTime(fat_date_time=0xa8d03d0c)
date_time_string = fat_date_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T21:06:32Z')
def testGetDate(self):
"""Tests the GetDate function."""
fat_date_time_object = fat_date_time.FATDateTime(fat_date_time=0xa8d03d0c)
......
......@@ -91,6 +91,13 @@ class FiletimeTest(unittest.TestCase):
date_time_string = filetime_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
filetime_object = filetime.Filetime(timestamp=0x01cb3a623d0a17ce)
date_time_string = filetime_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T21:06:31.5468750Z')
def testGetDate(self):
"""Tests the GetDate function."""
filetime_object = filetime.Filetime(timestamp=0x01cb3a623d0a17ce)
......
......@@ -96,6 +96,13 @@ class HFSTimeTest(unittest.TestCase):
date_time_string = hfs_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
hfs_time_object = hfs_time.HFSTime(timestamp=3458215528)
date_time_string = hfs_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2013-08-01T15:25:28Z')
def testGetDate(self):
"""Tests the GetDate function."""
hfs_time_object = hfs_time.HFSTime(timestamp=3458215528)
......
......@@ -75,6 +75,13 @@ class JavaTimeTest(unittest.TestCase):
date_time_string = java_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
java_time_object = java_time.JavaTime(timestamp=1281643591546)
date_time_string = java_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31.546Z')
def testGetDate(self):
"""Tests the GetDate function."""
java_time_object = java_time.JavaTime(timestamp=1281643591546)
......
......@@ -92,6 +92,14 @@ class OLEAutomationDateTest(unittest.TestCase):
date_time_string = ole_automation_date_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
ole_automation_date_object = ole_automation_date.OLEAutomationDate(
timestamp=43044.480556)
date_time_string = ole_automation_date_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2017-11-05T11:32:00.038400Z')
def testGetDate(self):
"""Tests the GetDate function."""
ole_automation_date_object = ole_automation_date.OLEAutomationDate(
......
......@@ -83,6 +83,13 @@ class PosixTimeTest(unittest.TestCase):
date_time_string = posix_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
posix_time_object = posix_time.PosixTime(timestamp=1281643591)
date_time_string = posix_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31Z')
# TODO: remove this method when there is no more need for it in dfvfs.
def testCopyToStatTimeTuple(self):
"""Tests the CopyToStatTimeTuple function."""
......@@ -191,6 +198,14 @@ class PosixTimeInMicrosecondsTest(unittest.TestCase):
date_time_string = posix_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
posix_time_object = posix_time.PosixTimeInMicroseconds(
timestamp=1281643591546875)
date_time_string = posix_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31.546875Z')
# TODO: remove this method when there is no more need for it in dfvfs.
def testCopyToStatTimeTuple(self):
"""Tests the CopyToStatTimeTuple function."""
......
......@@ -216,6 +216,14 @@ class RFC2579DateTimeTest(unittest.TestCase):
date_time_string = rfc2579_date_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
rfc2579_date_time_object = rfc2579_date_time.RFC2579DateTime(
rfc2579_date_time_tuple=(2010, 8, 12, 20, 6, 31, 6, '+', 0, 0))
date_time_string = rfc2579_date_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31.6Z')
def testGetDate(self):
"""Tests the GetDate function."""
rfc2579_date_time_object = rfc2579_date_time.RFC2579DateTime(
......
......@@ -80,6 +80,13 @@ class SemanticTimeTest(unittest.TestCase):
date_time_string = semantic_time_object.CopyToDateTimeString()
self.assertEqual(date_time_string, 'Never')
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
semantic_time_object = semantic_time.SemanticTime(string='Never')
date_time_string = semantic_time_object.CopyToDateTimeStringISO8601()
self.assertIsNone(date_time_string)
def testCopyToStatTimeTuple(self):
"""Tests the CopyToStatTimeTuple function."""
semantic_time_object = semantic_time.SemanticTime()
......
......@@ -172,6 +172,14 @@ class SystemtimeTest(unittest.TestCase):
date_time_string = systemtime_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
systemtime_object = systemtime.Systemtime(
system_time_tuple=(2010, 8, 4, 12, 20, 6, 31, 142))
date_time_string = systemtime_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31.142Z')
def testGetDate(self):
"""Tests the GetDate function."""
systemtime_object = systemtime.Systemtime(
......
......@@ -459,6 +459,14 @@ class TimeElementsTest(unittest.TestCase):
date_time_string = time_elements_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
time_elements_object = time_elements.TimeElements(
time_elements_tuple=(2010, 8, 12, 20, 6, 31))
date_time_string = time_elements_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31Z')
def testCopyToPosixTimestamp(self):
"""Tests the CopyToPosixTimestamp function."""
time_elements_object = time_elements.TimeElements(
......@@ -740,6 +748,14 @@ class TimeElementsInMillisecondsTest(unittest.TestCase):
date_time_string = time_elements_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
time_elements_object = time_elements.TimeElementsInMilliseconds(
time_elements_tuple=(2010, 8, 12, 20, 6, 31, 429))
date_time_string = time_elements_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31.429Z')
def testGetDate(self):
"""Tests the GetDate function."""
time_elements_object = time_elements.TimeElementsInMilliseconds(
......@@ -1008,6 +1024,14 @@ class TimeElementsInMicrosecondsTest(unittest.TestCase):
date_time_string = time_elements_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
time_elements_object = time_elements.TimeElementsInMicroseconds(
time_elements_tuple=(2010, 8, 12, 20, 6, 31, 429876))
date_time_string = time_elements_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T20:06:31.429876Z')
def testGetDate(self):
"""Tests the GetDate function."""
time_elements_object = time_elements.TimeElementsInMicroseconds(
......
......@@ -121,6 +121,14 @@ class UUIDTimeTest(unittest.TestCase):
date_time_string = uuid_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
uuid_object = uuid.UUID('00911b54-9ef4-11e1-be53-525400123456')
uuid_time_object = uuid_time.UUIDTime(timestamp=uuid_object.time)
date_time_string = uuid_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2012-05-16T01:11:01.6544084Z')
def testGetDate(self):
"""Tests the GetDate function."""
uuid_object = uuid.UUID('00911b54-9ef4-11e1-be53-525400123456')
......
......@@ -91,6 +91,13 @@ class WebKitTimeTest(unittest.TestCase):
date_time_string = webkit_time_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToDateTimeStringISO8601(self):
"""Tests the CopyToDateTimeStringISO8601 function."""
webkit_time_object = webkit_time.WebKitTime(timestamp=12926120791546875)
date_time_string = webkit_time_object.CopyToDateTimeStringISO8601()
self.assertEqual(date_time_string, '2010-08-12T21:06:31.546875Z')
def testGetDate(self):
"""Tests the GetDate function."""
webkit_time_object = webkit_time.WebKitTime(timestamp=12926120791546875)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment