We have some gen procs installed and one of them is called
gc_generateUniqueId.
proc gc_generateUniqueId { args } {
upvar xlateId xlateId
xlateInList xlateInList
xlateInTypes xlateInTypes
xlateInVals xlateInVals
xlateOutList xlateOutList
xlateOutTypes xlateOutTypes
xlateOutVals xlateOutVals
set module [lindex [info level 0] 0]
set debug “0”
set maxlength “-1”
catch {
keylget args DEBUG debug
keylget args MAXLENGTH maxlength
}
set uid [expr [getclock] + rand()] ; # e.g. 1128686054.99
if { [info exists xlateInVals] } {
foreach el $xlateInVals { append uid “/$el” }
}
if { [ctype digit $maxlength] && $maxlength > 0 && [clength $uid] > $maxlength } {
set uid “[string range $uid 0 [expr $maxlength – 1]]”
}
if { $debug } { puts stdout “$module (debug): Generated unique id of [string length $uid] chars ‘$uid'” }
set xlateOutVals [list $uid]
}