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.
Projectda4089/simplefix
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
| 83 | 83 | self.pairs.append((str(tag), str(value))) | |
| 84 | 84 | return | |
| 85 | 85 | ||
| 86 | - | def append_time(self, tag, timestamp = None, precision = 3, utc = True): | |
| 86 | + | def append_time(self, tag, timestamp=None, precision=3, utc=True): | |
| 87 | 87 | """Append a time field to this message. | |
| 88 | 88 | ||
| 89 | 89 | :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. | |
| 91 | 91 | :param precision: Number of decimal digits, defaults to milliseconds. | |
| 92 | 92 | :param utc: Use UTC if True, local time if False. | |
| 93 | 93 | ||
| ⋯ | |||
| 109 | 109 | else: | |
| 110 | 110 | t = timestamp | |
| 111 | 111 | ||
| 112 | - | s = t.isoformat('-') | |
| 112 | + | s = t.strftime("%Y%m%d-%H:%M:%S.") | |
| 113 | 113 | 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: | |
| 116 | 118 | raise ValueError("Precision should be either 3 or 6 digits") | |
| 117 | 119 | ||
| 118 | 120 | return self.append_pair(tag, s) | |
The check that tells the two apart
fail→pass·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.