On Wed, May 9, 2012, at 08:40 PM, Victor Whiskey Yankee wrote:
Hello List,
How can I create uuids so that the first one compares less than the next one.. something like this:
boost::uuids::t1 = boost::uuids::random_generator()(); boost::uuids::t2 = boost::uuids::random_generator()(); BOOST_REQUIRE(t1 < t2);
This is not guaranteed to be true, t1 may be greater than t2. It really is random data used to create the uuid in this case.
I don't see how to replace random_generator() with a time-based variant, if that even makes sense.
Sadly, I have not yet implemented a time-based generator for uuids. I plan to create a few platform specific generators that wrap OS calls that would do this.
If this can be done, then is there a way to extract the date+time from it?
If is is a time-based uuid, then the date and time can be extracted, but not from a random-based, or name-based (uses a hash).
Thanks, Vic
Regards, Andy Tompkins