Skip to content

Commit 446477d

Browse files
Clarify comment that this is UUIDv7-like format, not RFC-compliant
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
1 parent a9f8a4d commit 446477d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Common/Polyfills/System/GuidHelpers.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ internal static class GuidHelpers
1010
private static long s_counter;
1111

1212
/// <summary>
13-
/// Creates a monotonically increasing UUID v7 GUID with the specified timestamp.
13+
/// Creates a monotonically increasing GUID using a UUIDv7-like format with the specified timestamp.
1414
/// Uses a globally increasing counter for strict monotonicity.
1515
/// </summary>
1616
/// <param name="timestamp">The timestamp to embed in the GUID.</param>
17-
/// <returns>A new monotonically increasing UUID v7 GUID.</returns>
17+
/// <returns>A new monotonically increasing GUID.</returns>
1818
/// <remarks>
1919
/// <para>
2020
/// This method cannot be replaced with <c>Guid.CreateVersion7(DateTimeOffset)</c> because
@@ -25,11 +25,13 @@ internal static class GuidHelpers
2525
/// <para>
2626
/// This implementation uses a globally monotonically increasing counter to ensure that
2727
/// all generated GUIDs are strictly ordered by creation time, regardless of timestamp.
28+
/// The format is UUIDv7-like but not RFC 9562 compliant since we prioritize strict
29+
/// monotonicity over random bits in the counter field.
2830
/// </para>
2931
/// </remarks>
3032
public static Guid CreateMonotonicUuid(DateTimeOffset timestamp)
3133
{
32-
// UUID v7 format (RFC 9562):
34+
// UUIDv7-like format (based on RFC 9562 structure, but uses counter instead of random for strict monotonicity):
3335
// - 48 bits: Unix timestamp in milliseconds (big-endian)
3436
// - 4 bits: version (0111 = 7)
3537
// - 12 bits: counter/sequence (for intra-millisecond ordering)

0 commit comments

Comments
 (0)