Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #157 from Yelp/issue_156_invalid_timestamp_types
Browse files Browse the repository at this point in the history
Fixed invalid number mappings for datetime strings
  • Loading branch information
Leeren committed Sep 18, 2017
2 parents 2581ee5 + 2c1e80e commit 0fe96a8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osxcollector/osxcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ def _normalize_val(val, key=None):
:returns: A string
"""
# If the key hints this is a timestamp, try to use some popular formats
if key and any([-1 != key.lower().find(hint) for hint in ['time', 'utc', 'date', 'accessed']]):
if key and any([hint in key.lower() for hint in ['time', 'utc', 'date', 'accessed']]):
ts = _value_to_datetime(val)
# Known timestamp keys with values not conforming to heuristics are mapped to a default timestamp
if not ts and key in ['last_access_time', 'expires_utc', 'date_created', 'end_time']:
ts = datetime.fromtimestamp(1)
if ts:
return _datetime_to_string(ts)

Expand Down

0 comments on commit 0fe96a8

Please sign in to comment.