Skip to content

Commit

Permalink
Catch long datetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
thebeanogamer authored Jan 13, 2020
1 parent 424b230 commit 68f8417
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hstsparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ def date_round(date: datetime.datetime) -> datetime.datetime:
record[0] = re.search(r"^([^:\^]+)", record[0]).group(0)
record[2] = serial_date_to_string(record[2])
cleaned = record[3].split(",")
record[3] = datetime.datetime.fromtimestamp(int(cleaned[0]) / 1000)
try:
record[3] = datetime.datetime.fromtimestamp(int(cleaned[0]) / 1000)
except (OSError, ValueError):
record[3] = datetime.datetime.fromtimestamp(32503680000) # 3000-01-01 00:00:00
if int(cleaned[2]):
record.append("Yes")
else:
Expand Down

0 comments on commit 68f8417

Please sign in to comment.