Skip to content

Commit 5bbc670

Browse files
authored
Draft 04 (#56)
1 parent b137c4f commit 5bbc670

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# uuid-php
55

6-
A small PHP class for generating [RFC 4122][RFC 4122] version 3, 4, and 5 universally unique identifiers (UUID). Additionally supports [draft][draft 03] versions 6 and 7.
6+
A small PHP class for generating [RFC 4122][RFC 4122] version 3, 4, and 5 universally unique identifiers (UUID). Additionally supports [draft][draft 04] versions 6 and 7.
77

88
If all you want is a unique ID, you should call `uuid4()`.
99

@@ -60,7 +60,7 @@ var_dump($uuid6_first < $uuid6_second); // bool(true)
6060

6161
// Generate a version 7 (lexicographically sortable) UUID
6262
$uuid7_first = UUID::uuid7();
63-
echo $uuid7_first . "\n"; // e.g. 017f21cf-d130-7cc3-98c4-dc0c0c07398f
63+
echo $uuid7_first . "\n"; // e.g. 017f22e2-79b0-7cc3-98c4-dc0c0c07398f
6464
$uuid7_second = UUID::uuid7();
6565
var_dump($uuid7_first < $uuid7_second); // bool(true)
6666

@@ -114,8 +114,8 @@ var_dump($cmp3 === 0); // bool(true)
114114
// Extract Unix time from versions 6 and 7 as a string.
115115
$uuid6_time = UUID::getTime('1ec9414c-232a-6b00-b3c8-9e6bdeced846');
116116
var_dump($uuid6_time); // string(18) "1645557742.0000000"
117-
$uuid7_time = UUID::getTime('017f21cf-d130-7cc3-98c4-dc0c0c07398f');
118-
var_dump($uuid7_time); // string(18) "1645539742.0001995"
117+
$uuid7_time = UUID::getTime('017f22e2-79b0-7cc3-98c4-dc0c0c07398f');
118+
var_dump($uuid7_time); // string(18) "1645557742.0007977"
119119

120120
// Extract the UUID version.
121121
$uuid_version = UUID::getVersion('2140a926-4a47-465c-b622-4571ad9bb378');
@@ -148,5 +148,5 @@ var_dump($uuid_version); // int(4)
148148
14 bits dedicated to sub-second precision provide 100 nanosecond resolution. The `unix_ts` and `subsec` fields guarantee the order of UUIDs generated within the same timestamp by monotonically incrementing the timer.
149149

150150
[RFC 4122]: http://tools.ietf.org/html/rfc4122
151-
[draft 03]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03
151+
[draft 04]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04
152152
[stackoverflow uuid4]: https://stackoverflow.com/a/15875555

tests/UuidTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ public function testKnownGetTime()
191191
{
192192
$uuid6_time = UUID::getTime('1EC9414C-232A-6B00-B3C8-9E6BDECED846');
193193
$this->assertSame('1645557742.0000000', $uuid6_time);
194-
$uuid7_time = UUID::getTime('017F21CF-D130-7CC3-98C4-DC0C0C07398F');
195-
$this->assertSame('1645539742.000', substr($uuid7_time, 0, -4));
194+
$uuid7_time = UUID::getTime('017F22E2-79B0-7CC3-98C4-DC0C0C07398F');
195+
$this->assertSame('1645557742.000', substr($uuid7_time, 0, -4));
196196
}
197197

198198
public function testGetTimeValid()

0 commit comments

Comments
 (0)