This test flakes with <1% rate. There is a relevant comment
explaining that "timestamps only have a resolution of seconds"
and so we need to sleep for a second to actually see the timestamps
change. However, currently the tests sleeps *before* calculating
local time. Which beats the point. Move the local time declaration
before the sleep.
absl::ToTimeT() rounds down to the nearest second, discarding
nanoseconds field completely. I think the host kernel might be
rounding up the `msqid_ds` time fields.
Tested: 1000 runs of this test pass natively.
PiperOrigin-RevId: 455187650
Msgqueue tests were using fork() to run create a separate thread of
execution for passing messages back and forth over a queue. However,
the child process after a fork() may only use async-signal-safe
functions, which at a minimum exclude gtest asserts.
Instead, use threads.
PiperOrigin-RevId: 389073744