Commit 3af4516e authored by Hilko Bengen's avatar Hilko Bengen

New upstream version 20180509

parent e78f3c22
dfdatetime (20180501-1) unstable; urgency=low
dfdatetime (20180509-1) unstable; urgency=low
* Auto-generated
-- Log2Timeline <log2timeline-dev@googlegroups.com> Tue, 01 May 2018 17:49:01 +0200
\ No newline at end of file
-- Log2Timeline <log2timeline-dev@googlegroups.com> Wed, 09 May 2018 07:07:06 +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__ = '20180501'
__version__ = '20180509'
......@@ -827,6 +827,18 @@ class DateTimeValues(object):
ValueError: if the time string is invalid or not supported.
"""
def CopyToPosixTimestamp(self):
"""Copies the date time value to a POSIX timestamp.
Returns:
int: a POSIX timestamp in seconds or None if no timestamp is available.
"""
normalized_timestamp = self._GetNormalizedTimestamp()
if normalized_timestamp is None:
return None
return int(normalized_timestamp)
# TODO: remove this method when there is no more need for it in dfvfs.
def CopyToStatTimeTuple(self):
"""Copies the date time value to a stat timestamp tuple.
......
......@@ -459,6 +459,19 @@ class TimeElementsTest(unittest.TestCase):
date_time_string = time_elements_object.CopyToDateTimeString()
self.assertIsNone(date_time_string)
def testCopyToPosixTimestamp(self):
"""Tests the CopyToPosixTimestamp function."""
time_elements_object = time_elements.TimeElements(
time_elements_tuple=(2010, 8, 12, 20, 6, 31))
posix_timestamp = time_elements_object.CopyToPosixTimestamp()
self.assertEqual(posix_timestamp, 1281643591)
time_elements_object = time_elements.TimeElements()
posix_timestamp = time_elements_object.CopyToPosixTimestamp()
self.assertIsNone(posix_timestamp)
def testGetDate(self):
"""Tests the GetDate function."""
time_elements_object = time_elements.TimeElements(
......
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