Whole file

da4089/simplefix

The author described this change as Correct error in FIX UTCTimestamp formatting.. It counts as a record because the check below fails on the code as it stood at 3f4a9878d and passes on d636818b0, with nothing else changed between the two runs.

Fix saved2017-07-19
Sharing licenceMIT · LICENSE
Change size+7 5

What the code was meant to do, written into the code itself as a save note

Correct error in FIX UTCTimestamp formatting.

The change

8383 self.pairs.append((str(tag), str(value)))
8484 return
8585
86- def append_time(self, tag, timestamp = None, precision = 3, utc = True):
86+ def append_time(self, tag, timestamp=None, precision=3, utc=True):
8787 """Append a time field to this message.
8888
8989 :param tag: Integer or string FIX tag number.
90- :param timestamp: Time value to append, or None for now.
90+ :param timestamp: Time (see below) value to append, or None for now.
9191 :param precision: Number of decimal digits, defaults to milliseconds.
9292 :param utc: Use UTC if True, local time if False.
9393
109109 else:
110110 t = timestamp
111111
112- s = t.isoformat('-')
112+ s = t.strftime("%Y%m%d-%H:%M:%S.")
113113 if precision == 3:
114- s = s[:-3]
115- elif precision != 6:
114+ s += "%03d" % (t.microsecond / 1000)
115+ elif precision == 6:
116+ s += "%06d" % t.microsecond
117+ else:
116118 raise ValueError("Precision should be either 3 or 6 digits")
117119
118120 return self.append_pair(tag, s)

The check that tells the two apart

failpass·test/test_message.py::MessageTests::test_time_datetime

Check file test/test_message.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it3f4a9878d7a13fd77d171727f60c0ea4e356b10b
Broken version dated2017-07-07
Modulesimplefix.message
Units changedFixMessage
Fingerprint1c30a66315cf323a
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in da4089/simplefix