[Uid] Clarify the format returned by getTime()
This commit is contained in:
parent
b4ec36fad4
commit
c14c7376bd
@ -104,6 +104,9 @@ class Ulid extends AbstractUid
|
|||||||
return $this->uid;
|
return $this->uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return float Seconds since the Unix epoch 1970-01-01 00:00:00
|
||||||
|
*/
|
||||||
public function getTime(): float
|
public function getTime(): float
|
||||||
{
|
{
|
||||||
$time = strtr(substr($this->uid, 0, 10), 'ABCDEFGHJKMNPQRSTVWXYZ', 'abcdefghijklmnopqrstuv');
|
$time = strtr(substr($this->uid, 0, 10), 'ABCDEFGHJKMNPQRSTVWXYZ', 'abcdefghijklmnopqrstuv');
|
||||||
|
@ -31,6 +31,9 @@ class UuidV1 extends Uuid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return float Seconds since the Unix epoch 1970-01-01 00:00:00
|
||||||
|
*/
|
||||||
public function getTime(): float
|
public function getTime(): float
|
||||||
{
|
{
|
||||||
$time = '0'.substr($this->uid, 15, 3).substr($this->uid, 9, 4).substr($this->uid, 0, 8);
|
$time = '0'.substr($this->uid, 15, 3).substr($this->uid, 9, 4).substr($this->uid, 0, 8);
|
||||||
|
@ -32,6 +32,9 @@ class UuidV6 extends Uuid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return float Seconds since the Unix epoch 1970-01-01 00:00:00
|
||||||
|
*/
|
||||||
public function getTime(): float
|
public function getTime(): float
|
||||||
{
|
{
|
||||||
$time = '0'.substr($this->uid, 0, 8).substr($this->uid, 9, 4).substr($this->uid, 15, 3);
|
$time = '0'.substr($this->uid, 0, 8).substr($this->uid, 9, 4).substr($this->uid, 15, 3);
|
||||||
|
Reference in New Issue
Block a user