let's say I have multiple lists of objects (representing log-like record) containing the property returning a timestamp when they were created (it's simple datetime.now() record). My idea was that after I join all these objects to a single list, I sort them chronologically just by their "timestamp". They're not created in parallel (but by multiple class instances recursively), so I expected everytime I call datetime.now(), the record would be unique and sortable. The problem is that it seems the objects are created faster than datetime resolution can be enough, and many of the objects ends with the same "timestamp".
I made a workaround by adding another property "index" to the objects and separate counter, but it increased overall code complexity, I must watch out many places now to not forget counting, had to convert some static functions to instantiable etc... Is there a clean way to create timestamp that is unique for any call, sortable and possibly able to reformat on print output using string.format? Thank you!