Skip to content

Commit

Permalink
Fix another OSError and ValueError issue
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalsleuth committed Jul 23, 2022
1 parent 794dbdc commit 25d73d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="time_decode",
version="4.1.1",
version="4.1.2",
author="Corey Forman",
license="MIT",
url="https://github.com/digitalsleuth/time_decode",
Expand Down
18 changes: 11 additions & 7 deletions time_decode/time_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
init(autoreset=True)

__author__ = 'Corey Forman'
__date__ = '22 Jul 2022'
__version__ = '4.1.1'
__date__ = '23 Jul 2022'
__version__ = '4.1.2'
__description__ = 'Python 3 CLI Date Time Conversion Tool'
__fmt__ = '%Y-%m-%d %H:%M:%S.%f'
__red__ = "\033[1;31m"
Expand Down Expand Up @@ -821,10 +821,11 @@ def from_hfs_dec(self):
if len(str(self.hfsdec)) != 10 or not (self.hfsdec).isdigit():
self.in_hfs_dec = indiv_output = combined_output = False
else:
self.in_hfs_dec = dt.utcfromtimestamp(float
(int(self.hfsdec)
- self.epochs['hfs_dec_sub'])
).strftime(__fmt__)
minus_epoch = float(int(self.hfsdec) - self.epochs['hfs_dec_sub'])
if minus_epoch < 0:
pass
else:
self.in_hfs_dec = dt.utcfromtimestamp(minus_epoch).strftime(__fmt__)
indiv_output = str(f"{ts_type} {self.in_hfs_dec} UTC")
combined_output = str(f"{__red__}{ts_type}\t{self.in_hfs_dec} UTC{__clr__}")
except Exception:
Expand Down Expand Up @@ -2330,7 +2331,10 @@ def from_bitdec(self):
bd_day = (full_ts >> 11) & 31
bd_hr = (full_ts >> 6) & 31
bd_min = full_ts & 63
self.in_bitdec = dt(bd_yr, bd_mon, bd_day, bd_hr, bd_min).strftime(__fmt__)
try:
self.in_bitdec = dt(bd_yr, bd_mon, bd_day, bd_hr, bd_min).strftime(__fmt__)
except ValueError:
pass
indiv_output = str(f"{ts_type} {self.in_bitdec}")
combined_output = str(f"{__red__}{ts_type}\t\t{self.in_bitdec} ?{__clr__}")
except Exception:
Expand Down

0 comments on commit 25d73d5

Please sign in to comment.