UUIDTime (System function)
Get a binary UUID time (System class)
[Introduced in Model 204 7.5]
The UUIDTime function provides an eight-byte binary representation of a UUID time stamp, the number of 100 nanosecond intervals since the initial adoption of the Gregorian calendar on October 15, 1582.
%string = %(System):UUIDTime
|%string||The eight-byte binary value of the UUID timestamp corresponding to the system TOD clock at the time the method was invoked.|
|%(System)||The class name in parentheses denotes a shared method. UUIDTime can also be invoked via a System object variable, which may be Null.|
- UUID time stamps are used to generate version 1 universal unique identifiers. A useful link on that page is to the UUID RFC.
- A UUID time typically requires approximately 19 significant decimal digits to represent. Unfortunately Model 204 only really supports 15 decimal places. But this is not important for using UUID time stamps to generate a version 1 UUID as all that's required to do this is to convert the binary UUID time to hexadecimal and then rearrange it, and add dashes, a clock sequence, and a MAC adress.
The following example illustrates the use of the result of a UUIDTime method invocation to generate a UUID. The details of how the clock sequence number is calculated (the high order two bits are actually a variant indicator), and how the MAC address is obtained is left for the programmer to determine.
%uuidTime is string len 16 %uuid is string len 64 ... %uuidTime = %(system):uuidTime:stringToHex %uuid = %uuidTime:right(8) '-' %uuidTime:substring(5, 4) '-1' - %uuidTime:substring(2, 3) '-' %clockSequence '-' - %macAddress