Skip to content

Commit 70c9b80

Browse files
committed
Windows CI: the cause of the problems found, try to fix
1 parent 9a0a3d6 commit 70c9b80

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

std/uuid.d

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,17 +1512,23 @@ class MonotonicUUIDsFactory
15121512
/// Generate monotone UUIDs
15131513
@system unittest
15141514
{
1515+
import core.thread.osthread : Thread;
1516+
15151517
scope f = new shared MonotonicUUIDsFactory;
15161518

15171519
UUID[1000] uuids;
15181520

15191521
foreach (ref u; uuids)
1522+
{
1523+
// UUIDv7 Method 3 monotonicity is only guaranteed if UUIDs are
1524+
// generated slower than 2.5 microseconds
1525+
Thread.sleep(dur!("hnsecs")(25));
15201526
u = f.createUUIDv7_method3;
1527+
}
15211528

15221529
foreach (i; 1 .. uuids.length)
15231530
{
1524-
//FIXME: disabled for attempt to fix Windows CI
1525-
//~ assert(uuids[i-1].v7Timestamp_method3 < uuids[i].v7Timestamp_method3);
1531+
assert(uuids[i-1].v7Timestamp_method3 < uuids[i].v7Timestamp_method3);
15261532
assert(uuids[i-1].data[8 .. $] != uuids[i].data[8 .. $], "random parts are not equal");
15271533
}
15281534
}

0 commit comments

Comments
 (0)