I have multiple processes that communicate with each other running on different cores of a dual-processor X86-64 Linux machine. The content of the communication includes timestamps. I want to write time-related logic of the programs with the simple assumption that all the timestamps are from the same global clock. Can I count on
clock_gettime(CLOCK_MONOTONIC) to give me monotonic timestamps even across different threads running on different cores?
Particularly, suppose Process A takes a timestamp X and sends it to Process B via shared memory. Process B reads it and then takes a timestamp Y. X cannot be greater than Y.
Does the timestamp taken using
clock_gettime(CLOCK_MONOTONIC) have the above property? If not, what are some other types of monotonic timestamp that have this property?