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 d6af824 commit c3f1f26Copy full SHA for c3f1f26
std/uuid.d
@@ -568,12 +568,15 @@ public struct UUID
568
throw new UUIDParsingException("The UUID is not of version" ~
569
" v7 therefore no timestamp exist", 0);
570
}
571
- ulong milli = (cast(ulong)(this.data[0]) << 40) |
572
- (cast(ulong)(this.data[1]) << 32) |
573
- (cast(ulong)(this.data[2]) << 24) |
574
- (cast(ulong)(this.data[3]) << 16) |
575
- (cast(ulong)(this.data[4]) << 8) |
576
- (cast(ulong)(this.data[5]));
+
+ import std.bitmanip : bigEndianToNative;
+ ubyte[8] tmp = void;
+ tmp[0 .. 2] = 0;
+ tmp[2 .. 8] = data[0 .. 6];
577
578
+ ulong milli = tmp.bigEndianToNative!ulong;
579
580
return SysTime(DateTime(1970, 1, 1), UTC()) + dur!"msecs"(milli);
581
582
0 commit comments