UUIDTime (System function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Template:System:UUIDTime subtitle}}
{{Template:System:UUIDTime subtitle}}
 
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.  
This page is [[under construction]].
==Syntax==
==Syntax==
{{Template:System:UUIDTime syntax}}
{{Template:System:UUIDTime syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%string</th><td>string</td></tr>
<tr><th>%string</th><td>The eight-byte binary value of the UUID timestamp corresponding to the system TOD clock at the time the method was invoked.</td></tr>
<tr><th nowrap="true"><var>%(System)</var></th>
<tr><th nowrap="true"><var>%(System)</var></th>
<td>The class name in parentheses denotes a shared method. <var>UUIDTime</var> can also be invoked via a <var>System</var> object variable, which may be <var>Null</var>.</td></tr>
<td>The class name in parentheses denotes a shared method. <var>UUIDTime</var> can also be invoked via a <var>System</var> object variable, which may be <var>Null</var>.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<li>UUID time stamps are used to generate version 1 [http://en.wikipedia.org/wiki/Universally_unique_identifier universal unique identifiers]. A useful link on that page is to [http://tools.ietf.org/html/rfc4122 the UUID RFC].
<li>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. 
</ul>
==Examples==
==Examples==
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.
<p class="code">%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
</p>
==See also==
==See also==
<ul>
<li>[[TODClock (System function)]]
</ul>
{{Template:System:UUIDTime footer}}
{{Template:System:UUIDTime footer}}

Latest revision as of 03:11, 9 May 2014

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.

Syntax

%string = %(System):UUIDTime

Syntax terms

%stringThe 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.

Usage notes

  • 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.

Examples

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

See also