Jul-07-2020, 02:44 AM
i want to get either a string or a number which:
1. always sorts in time order even if the system reboots
2. no 2 calls by any user or process can ever get the same result
3. is portable across across Windows and all POSIX compliant systems
obviously this depends on the system having capability. if a system only has a one-second clock event, the OS would need to compensate such as by appending a call counter. does Python provide such a thing? if this can be done by some amount of user space C code that is portable enough (system test code is OK) then i would expect there to be a way to do it in Python.
i have been using int(time.time()*3906250) on recent Linux. that number (10**9/2**8) shifts the significant bits in floating point time that Linux provides to be whole numbers. i do not have Windows to test on.
1. always sorts in time order even if the system reboots
2. no 2 calls by any user or process can ever get the same result
3. is portable across across Windows and all POSIX compliant systems
obviously this depends on the system having capability. if a system only has a one-second clock event, the OS would need to compensate such as by appending a call counter. does Python provide such a thing? if this can be done by some amount of user space C code that is portable enough (system test code is OK) then i would expect there to be a way to do it in Python.
i have been using int(time.time()*3906250) on recent Linux. that number (10**9/2**8) shifts the significant bits in floating point time that Linux provides to be whole numbers. i do not have Windows to test on.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.