@@ -17,8 +17,8 @@ public class UUIDv1
1717 /// <summary>
1818 /// Initialises a new GUID/UUID based on Version 1 (date-time and MAC address)
1919 /// </summary>
20- /// <returns>A new Guid object</returns>
21- public static Guid NewUUIDv1 ( )
20+ /// <returns>A new Uuid object</returns>
21+ public static Uuid NewUUIDv1 ( )
2222 {
2323 return NewUUIDv1 ( DateTime . UtcNow ) ;
2424 }
@@ -89,8 +89,8 @@ public static Byte[] GetClockSequence()
8989 /// Initialises a new GUID/UUID based on Version 1 (date-time and MAC address), based on the given date and time.
9090 /// </summary>
9191 /// <param name="dateTime">Given Date and Time</param>
92- /// <returns>A new Guid object</returns>
93- public static Guid NewUUIDv1 ( DateTime dateTime )
92+ /// <returns>A new Uuid object</returns>
93+ public static Uuid NewUUIDv1 ( DateTime dateTime )
9494 {
9595 return NewUUIDv1 ( dateTime , GetClockSequence ( ) , GetNodeID ( ) ) ;
9696 }
@@ -99,10 +99,10 @@ public static Guid NewUUIDv1(DateTime dateTime)
9999 /// Initialises a new GUID/UUID based on Version 1 (date-time and MAC address), based on the given Node ID.
100100 /// </summary>
101101 /// <param name="nodeID">Given 48-bit Node ID</param>
102- /// <returns>A new Guid object</returns>
102+ /// <returns>A new Uuid object</returns>
103103 /// <exception cref="ArgumentNullException"></exception>
104104 /// <exception cref="ArgumentException"></exception>
105- public static Guid NewUUIDv1 ( Byte [ ] nodeID )
105+ public static Uuid NewUUIDv1 ( Byte [ ] nodeID )
106106 {
107107 return NewUUIDv1 ( DateTime . UtcNow , GetClockSequence ( ) , nodeID ) ;
108108 }
@@ -113,10 +113,10 @@ public static Guid NewUUIDv1(Byte[] nodeID)
113113 /// <param name="dateTime">Given Date and Time</param>
114114 /// <param name="clockSequence">Given 16-bit Clock Sequence with Variant</param>
115115 /// <param name="nodeID">Given 48-bit Node ID</param>
116- /// <returns>A new Guid object</returns>
116+ /// <returns>A new Uuid object</returns>
117117 /// <exception cref="ArgumentNullException"></exception>
118118 /// <exception cref="ArgumentException"></exception>
119- public static Guid NewUUIDv1 ( DateTime dateTime , Byte [ ] clockSequence , Byte [ ] nodeID )
119+ public static Uuid NewUUIDv1 ( DateTime dateTime , Byte [ ] clockSequence , Byte [ ] nodeID )
120120 {
121121 if ( clockSequence == null )
122122 throw new ArgumentNullException ( nameof ( clockSequence ) ) ;
@@ -133,20 +133,20 @@ public static Guid NewUUIDv1(DateTime dateTime, Byte[] clockSequence, Byte[] nod
133133 TimeSpan timesince = dateTime . ToUniversalTime ( ) - s_epoch . ToUniversalTime ( ) ;
134134 Int64 timeinterval = timesince . Ticks ;
135135
136- Byte [ ] time = BitConverter . GetBytes ( timeinterval ) ;
136+ Byte [ ] time = BitConverter . GetBytes ( System . Net . IPAddress . HostToNetworkOrder ( timeinterval ) ) ;
137137
138138 Byte [ ] hex = new Byte [ 16 ] ;
139139
140- hex [ 0 ] = time [ 0 ] ;
141- hex [ 1 ] = time [ 1 ] ;
142- hex [ 2 ] = time [ 2 ] ;
143- hex [ 3 ] = time [ 3 ] ;
140+ hex [ 0 ] = time [ 4 ] ;
141+ hex [ 1 ] = time [ 5 ] ;
142+ hex [ 2 ] = time [ 6 ] ;
143+ hex [ 3 ] = time [ 7 ] ;
144144
145- hex [ 4 ] = time [ 4 ] ;
146- hex [ 5 ] = time [ 5 ] ;
145+ hex [ 4 ] = time [ 2 ] ;
146+ hex [ 5 ] = time [ 3 ] ;
147147
148- hex [ 6 ] = time [ 6 ] ;
149- hex [ 7 ] = ( Byte ) ( ( time [ 7 ] & 0x0F ) + 0x10 ) ;
148+ hex [ 6 ] = ( Byte ) ( ( time [ 0 ] & 0x0F ) + 0x10 ) ;
149+ hex [ 7 ] = time [ 1 ] ;
150150
151151 hex [ 8 ] = clockSequence [ 0 ] ;
152152 hex [ 9 ] = clockSequence [ 1 ] ;
@@ -158,7 +158,7 @@ public static Guid NewUUIDv1(DateTime dateTime, Byte[] clockSequence, Byte[] nod
158158 hex [ 14 ] = nodeID [ 4 ] ;
159159 hex [ 15 ] = nodeID [ 5 ] ;
160160
161- Guid Id = new Guid ( hex ) ;
161+ Uuid Id = new Uuid ( hex ) ;
162162
163163 return Id ;
164164 }
0 commit comments