allows generator to use supplied DateTime
This commit is contained in:
parent
5ff25f397f
commit
e640e52f19
@ -101,10 +101,10 @@ internal static class Commons
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GenerateUuidV7()
|
||||
internal static string GenerateUuidV7(DateTime? BaseTime = null)
|
||||
{
|
||||
Span<byte> uuidBytes = stackalloc byte[16];
|
||||
long time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
long time = (BaseTime is null ? DateTimeOffset.UtcNow : new DateTimeOffset((DateTime)BaseTime)).ToUnixTimeMilliseconds();
|
||||
RandomNumberGenerator.Fill(uuidBytes[7..]);
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user