Hello Victor, It is actually not that I need the 2 UUIDs to be exactly same - they need to be same timestamp wise.
So, what I need is to extract the timestamp portion from a time UUID (say, U1) and then later in the cycle, use the same long timestamp value to re-create a UUID (say, U2) that is equivalent of the previous one in terms of its timestamp portion - i.e., I should be able to give this U2 and filter the data from a column family - and it should be same as if I had used the original UUID U1. Does it make any more sense than before? Any way I can do that? rgds, Roshan On Tue, Jan 4, 2011 at 11:46 PM, Victor Kabdebon <victor.kabde...@gmail.com>wrote: > Hello Roshan, > > Well it is normal to do not be able to get the exact same UUID from a > timestamp, it is its purpose. > When you create an UUID you have in fact two information : random 64 bits > number - 64 bits timestamp. You put that together and you have your uuid. > . > So unless you save your random number two UUID for the same milli( or > micro) second are different. > > Best regards, > Victor K. > http://www.voxnucleus.fr > > 2011/1/4 Roshan Dawrani <roshandawr...@gmail.com> > > Hi, >> I am having a little difficulty converting a time UUID to its timestamp >> equivalent and back. Can someone please help? >> >> Here is what I am trying. Is it not the right way to do it? >> >> =========================================================== >> UUID someUUID = TimeUUIDUtils.getUniqueTimeUUIDinMillis(); >> >> long time = someUUID.timestamp(); /* convery from UUID to a long >> timestamp */ >> UUID otherUUID = TimeUUIDUtils.getTimeUUID(time); /* do the >> reverse and get back the UUID from timestamp */ >> >> System.out.println(someUUID); /* someUUID and otherUUID should be >> same, but are different */ >> System.out.println(otherUUID); >> =========================================================== >> >> -- >> Roshan >> Blog: http://roshandawrani.wordpress.com/ >> Twitter: @roshandawrani <http://twitter.com/roshandawrani> >> Skype: roshandawrani >> >> > -- Roshan Blog: http://roshandawrani.wordpress.com/ Twitter: @roshandawrani <http://twitter.com/roshandawrani> Skype: roshandawrani