mirror of
https://github.com/boostorg/uuid.git
synced 2026-01-19 04:42:16 +00:00
47 lines
1.0 KiB
Plaintext
47 lines
1.0 KiB
Plaintext
[#time_generator_v6]
|
|
== <boost/uuid/{zwsp}time_generator_v6.hpp>
|
|
|
|
:idprefix: time_generator_v6_
|
|
|
|
=== Synopsis
|
|
|
|
[source,c++]
|
|
----
|
|
namespace boost {
|
|
namespace uuids {
|
|
|
|
class time_generator_v6
|
|
{
|
|
public:
|
|
|
|
struct state_type
|
|
{
|
|
std::uint64_t timestamp;
|
|
std::uint16_t clock_seq;
|
|
};
|
|
|
|
private: // exposition only
|
|
|
|
uuid::node_type node_ = {};
|
|
|
|
std::atomic<state_type>* ps_ = nullptr;
|
|
state_type state_ = {};
|
|
|
|
public:
|
|
|
|
using result_type = uuid;
|
|
|
|
time_generator_v6();
|
|
time_generator_v6( uuid::node_type const& node, state_type const& state ) noexcept;
|
|
time_generator_v6( uuid::node_type const& node, std::atomic<state_type>& state ) noexcept;
|
|
|
|
result_type operator()() noexcept;
|
|
};
|
|
|
|
}} // namespace boost::uuids
|
|
----
|
|
|
|
The class `time_generator_v6` generates time-based version 6 UUIDs, as described in https://datatracker.ietf.org/doc/rfc9562/[RFC 9562] section 5.6.
|
|
|
|
It operates in the exact same manner as `time_generator_v1`, with the only difference being that it produces version 6 UUIDs rather than version 1 ones.
|