예제 #1
0
    def get_timelastmodified(self):
        """Collect all timestamps for the Reference object, take the latest, and convert to AGR spec."""
        timestamp_list = []
        attribute_list = self.__dict__.keys()
        for attribute in attribute_list:
            if attribute.endswith('timelastmodified') and getattr(
                    self, attribute) is not None:
                timestamp_list.append(getattr(self, attribute))
        # Sort the timestamps and take the last one (i.e., the latest timestamp).
        max_timestamp = sorted(timestamp_list)[-1]
        # Convert datetime to strict_rfc3339 (via timestamp).
        self.agr_date_last_modified = strict_rfc3339.timestamp_to_rfc3339_localoffset(
            datetime.datetime.timestamp(max_timestamp))

        return
예제 #2
0
def get_xml_date(value):
    return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value))
예제 #3
0
def get_xml_date(value):
    if value == 'now':
        value = time.time()
    return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value))
 def fake_rfc3339(self, value):
     """what the local RFC3339 will be `value` fake seconds into the test"""
     return strict_rfc3339.timestamp_to_rfc3339_localoffset(1300000000 +
                                                            value)
예제 #5
0
def get_xml_date(value):
    """ Formats timestamps like 1985-04-12T23:20:50.52Z
    """
    if value == 'now':
        value = time.time()
    return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value))
예제 #6
0
def get_xml_date(value):
    """ Formats timestamps like 1985-04-12T23:20:50.52Z
    """
    if value == 'now':
        value = time.time()
    return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value))
 def fake_rfc3339(self, value):
     """what the local RFC3339 will be `value` fake seconds into the test"""
     return strict_rfc3339.timestamp_to_rfc3339_localoffset(
                 1300000000 + value)
예제 #8
0
def get_xml_date(value):
    if value == 'now':
        value = time.time()
    return strict_rfc3339.timestamp_to_rfc3339_localoffset(int(value))