Keep in mind that a string like that won't have any guarantee of uniqueness. With a multicore system you could easily have two timestamps generated with the same value. What will your code do when that happens?
Some of the previous discussion of UUIDs might be helpful: http://markmail.org/message/mql6teskkwb574na http://markmail.org/message/lpnvzugqg2awu3h2 -- Mike On 29 May 2013, at 09:15 , John Snelson <[email protected]> wrote: > I think the number underneath is consistent, but the serialization is > changing according to the particular time. What about creating the > timestamp like this? > > xs:string( > (current-dateTime() - xs:dateTime("0001-01-01T00:00:00.0Z")) > div xs:dayTimeDuration("PT0.000001S") > ) > > John > > On 29/05/13 17:07, Tim wrote: >> Hi Folks, >> >> I am using fn:current-dateTime() to create a unique timestamp for >> creating archive filenames, e.g., >> >> *let **$dt*:= fn:/current-dateTime/() *cast as **xs:string* >> *return */replace/(/substring/(*$dt*, 1, 22), "[:\-T\.]", "") >> >> To make it truly unique I need to include part of the fraction of a >> second, but I noticed that fn:current-dateTime() does not always return >> the same number of digits for fractions of a second. I have seen >> results with a range anywhere from 2 to 6 digits. Is there a minimum >> amount of digits that will be supplied in the fractions digits? >> >> Thank you! >> >> Tim Meagher > > -- > John Snelson, Lead Engineer http://twitter.com/jpcs > MarkLogic Corporation http://www.marklogic.com > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
