[Uid] Clarify the format returned by getTime()

This commit is contained in:
Thomas Calvet 2021-01-19 13:20:25 +01:00
parent b4ec36fad4
commit c14c7376bd
3 changed files with 9 additions and 0 deletions

View File

@ -104,6 +104,9 @@ class Ulid extends AbstractUid
return $this->uid;
}
/**
* @return float Seconds since the Unix epoch 1970-01-01 00:00:00
*/
public function getTime(): float
{
$time = strtr(substr($this->uid, 0, 10), 'ABCDEFGHJKMNPQRSTVWXYZ', 'abcdefghijklmnopqrstuv');

View File

@ -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
{
$time = '0'.substr($this->uid, 15, 3).substr($this->uid, 9, 4).substr($this->uid, 0, 8);

View File

@ -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
{
$time = '0'.substr($this->uid, 0, 8).substr($this->uid, 9, 4).substr($this->uid, 15, 3);