MCPcopy Create free account
hub / github.com/STIXProject/python-stix / set_received_time

Method set_received_time

stix/indicator/indicator.py:646–671  ·  view source on GitHub ↗

Sets the received time for this :class:`Indicator`. This is the same as calling ``indicator.producer.time.produced_time = produced_time``. The `received_time` parameter must be an instance of ``str``, ``datetime.datetime``, or ``cybox.common.DateTimeWithPrecision``.

(self, received_time)

Source from the content-addressed store, hash-verified

644 return None
645
646 def set_received_time(self, received_time):
647 """Sets the received time for this :class:`Indicator`.
648
649 This is the same as calling
650 ``indicator.producer.time.produced_time = produced_time``.
651
652 The `received_time` parameter must be an instance of ``str``,
653 ``datetime.datetime``, or ``cybox.common.DateTimeWithPrecision``.
654
655 Args:
656 received_time: An instance of ``str``,
657 ``datetime.datetime``, or ``cybox.common.DateTimeWithPrecision``.
658
659 Note:
660 If `received_time` is a ``str`` or ``datetime.datetime`` instance
661 an attempt will be made to convert it into an instance of
662 ``cybox.common.DateTimeWithPrecision``.
663
664 """
665 if not self.producer:
666 self.producer = InformationSource()
667
668 if not self.producer.time:
669 self.producer.time = Time()
670
671 self.producer.time.received_time = received_time
672
673 def get_received_time(self):
674 """Gets the received time for this :class:`Indicator`.

Callers

nothing calls this directly

Calls 2

InformationSourceClass · 0.90
TimeClass · 0.85

Tested by

no test coverage detected