We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de3931f commit dc84fd7Copy full SHA for dc84fd7
std/uuid.d
@@ -565,12 +565,15 @@ public struct UUID
565
throw new UUIDParsingException("The UUID is not of version" ~
566
" v7 therefore no timestamp exist", 0);
567
}
568
- ulong milli = (cast(ulong)(this.data[0]) << 40) |
569
- (cast(ulong)(this.data[1]) << 32) |
570
- (cast(ulong)(this.data[2]) << 24) |
571
- (cast(ulong)(this.data[3]) << 16) |
572
- (cast(ulong)(this.data[4]) << 8) |
573
- (cast(ulong)(this.data[5]));
+
+ import std.bitmanip : bigEndianToNative;
+ ubyte[8] tmp = void;
+ tmp[0 .. 2] = 0;
+ tmp[2 .. 8] = data[0 .. 6];
574
575
+ ulong milli = tmp.bigEndianToNative!ulong;
576
577
return SysTime(DateTime(1970, 1, 1), UTC()) + dur!"msecs"(milli);
578
579
0 commit comments