@@ -17,8 +17,8 @@ public class UUIDv1
17
17
/// <summary>
18
18
/// Initialises a new GUID/UUID based on Version 1 (date-time and MAC address)
19
19
/// </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 ( )
22
22
{
23
23
return NewUUIDv1 ( DateTime . UtcNow ) ;
24
24
}
@@ -89,8 +89,8 @@ public static Byte[] GetClockSequence()
89
89
/// Initialises a new GUID/UUID based on Version 1 (date-time and MAC address), based on the given date and time.
90
90
/// </summary>
91
91
/// <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 )
94
94
{
95
95
return NewUUIDv1 ( dateTime , GetClockSequence ( ) , GetNodeID ( ) ) ;
96
96
}
@@ -99,10 +99,10 @@ public static Guid NewUUIDv1(DateTime dateTime)
99
99
/// Initialises a new GUID/UUID based on Version 1 (date-time and MAC address), based on the given Node ID.
100
100
/// </summary>
101
101
/// <param name="nodeID">Given 48-bit Node ID</param>
102
- /// <returns>A new Guid object</returns>
102
+ /// <returns>A new Uuid object</returns>
103
103
/// <exception cref="ArgumentNullException"></exception>
104
104
/// <exception cref="ArgumentException"></exception>
105
- public static Guid NewUUIDv1 ( Byte [ ] nodeID )
105
+ public static Uuid NewUUIDv1 ( Byte [ ] nodeID )
106
106
{
107
107
return NewUUIDv1 ( DateTime . UtcNow , GetClockSequence ( ) , nodeID ) ;
108
108
}
@@ -113,10 +113,10 @@ public static Guid NewUUIDv1(Byte[] nodeID)
113
113
/// <param name="dateTime">Given Date and Time</param>
114
114
/// <param name="clockSequence">Given 16-bit Clock Sequence with Variant</param>
115
115
/// <param name="nodeID">Given 48-bit Node ID</param>
116
- /// <returns>A new Guid object</returns>
116
+ /// <returns>A new Uuid object</returns>
117
117
/// <exception cref="ArgumentNullException"></exception>
118
118
/// <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 )
120
120
{
121
121
if ( clockSequence == null )
122
122
throw new ArgumentNullException ( nameof ( clockSequence ) ) ;
@@ -133,20 +133,20 @@ public static Guid NewUUIDv1(DateTime dateTime, Byte[] clockSequence, Byte[] nod
133
133
TimeSpan timesince = dateTime . ToUniversalTime ( ) - s_epoch . ToUniversalTime ( ) ;
134
134
Int64 timeinterval = timesince . Ticks ;
135
135
136
- Byte [ ] time = BitConverter . GetBytes ( timeinterval ) ;
136
+ Byte [ ] time = BitConverter . GetBytes ( System . Net . IPAddress . HostToNetworkOrder ( timeinterval ) ) ;
137
137
138
138
Byte [ ] hex = new Byte [ 16 ] ;
139
139
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 ] ;
144
144
145
- hex [ 4 ] = time [ 4 ] ;
146
- hex [ 5 ] = time [ 5 ] ;
145
+ hex [ 4 ] = time [ 2 ] ;
146
+ hex [ 5 ] = time [ 3 ] ;
147
147
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 ] ;
150
150
151
151
hex [ 8 ] = clockSequence [ 0 ] ;
152
152
hex [ 9 ] = clockSequence [ 1 ] ;
@@ -158,7 +158,7 @@ public static Guid NewUUIDv1(DateTime dateTime, Byte[] clockSequence, Byte[] nod
158
158
hex [ 14 ] = nodeID [ 4 ] ;
159
159
hex [ 15 ] = nodeID [ 5 ] ;
160
160
161
- Guid Id = new Guid ( hex ) ;
161
+ Uuid Id = new Uuid ( hex ) ;
162
162
163
163
return Id ;
164
164
}
0 commit comments