Missing instantiation of STIXdatetime in parser. Added __repr__() to STIXdatetime class.

stix2.1
Emmanuelle Vargas-Gonzalez 2017-08-11 15:04:58 -04:00
parent e52575e01a
commit 56d8ca4939
1 changed files with 4 additions and 1 deletions

View File

@ -24,6 +24,9 @@ class STIXdatetime(dt.datetime):
self.precision = precision
return self
def __repr__(self):
return "'%s'" % format_datetime(self)
def get_timestamp():
return STIXdatetime.now(tz=pytz.UTC)
@ -77,7 +80,7 @@ def parse_into_datetime(value, precision=None):
# Ensure correct precision
if not precision:
return ts
return STIXdatetime(ts, precision=precision)
ms = ts.microsecond
if precision == 'second':
ts = ts.replace(microsecond=0)