Make debug_timestamp() thread-safe.