Skip to content

Commit

Permalink
Changes for nanoseconds dfDateTime (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Dec 29, 2023
1 parent 8fcf211 commit 3cc53c2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dfvfs (20231208-1) unstable; urgency=low
dfvfs (20231229-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <[email protected]> Fri, 08 Dec 2023 06:59:06 +0100
-- Log2Timeline maintainers <[email protected]> Fri, 29 Dec 2023 05:50:02 +0100
2 changes: 1 addition & 1 deletion dfvfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
storage media types and file formats.
"""

__version__ = '20231208'
__version__ = '20231229'
18 changes: 10 additions & 8 deletions dfvfs/vfs/tsk_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def CopyFromDateTimeString(self, time_string):
YYYY-MM-DD hh:mm:ss.######[+-]##:##
Where # are numeric digits ranging from 0 to 9 and the seconds
fraction can be either 3 or 6 digits. The time of day, seconds
fraction can be either 3, 6 or 9 digits. The time of day, seconds
fraction and time zone offset are optional. The default time zone
is UTC.
"""
Expand All @@ -116,18 +116,20 @@ def CopyFromDateTimeString(self, time_string):
hours = date_time_values.get('hours', 0)
minutes = date_time_values.get('minutes', 0)
seconds = date_time_values.get('seconds', 0)
microseconds = date_time_values.get('microseconds', 0)
nanoseconds = date_time_values.get('nanoseconds', None)
time_zone_offset = date_time_values.get('time_zone_offset', 0)

self._timestamp = self._GetNumberOfSecondsFromElements(
year, month, day_of_month, hours, minutes, seconds)
self.fraction_of_second = microseconds
self._time_zone_offset = time_zone_offset

if pytsk3.TSK_VERSION_NUM >= 0x040200ff:
self.fraction_of_second *= 1000
if nanoseconds is not None:
self.fraction_of_second = nanoseconds
else:
self.fraction_of_second *= 10
# TODO: kept for backwards compatibility with older dfdatetime versions.
self.fraction_of_second = date_time_values.get('microseconds', 0) * 1000

self._precision = dfdatetime_definitions.PRECISION_1_NANOSECOND
self._time_zone_offset = time_zone_offset

self._normalized_timestamp = None
self.is_local_time = False
Expand All @@ -153,7 +155,7 @@ def CopyToDateTimeString(self):
return (f'{year:04d}-{month:02d}-{day_of_month:02d} '
f'{hours:02d}:{minutes:02d}:{seconds:02d}')

if pytsk3.TSK_VERSION_NUM >= 0x040200ff:
if self._precision == dfdatetime_definitions.PRECISION_1_NANOSECOND:
return (f'{year:04d}-{month:02d}-{day_of_month:02d} '
f'{hours:02d}:{minutes:02d}:{seconds:02d}'
f'.{self.fraction_of_second:09d}')
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = dfvfs
version = 20231227
version = 20231229
description = Digital Forensics Virtual File System (dfVFS).
long_description = dfVFS, or Digital Forensics Virtual File System, provides read-only access to file-system objects from various storage media types and file formats. The goal of dfVFS is to provide a generic interface for accessing file-system objects, for which it uses several back-ends that provide the actual implementation of the various storage media types, volume systems and file systems.
long_description_content_type = text/plain
Expand Down

0 comments on commit 3cc53c2

Please sign in to comment.