From eb193b9b222ab7a96b222add21a3689909328458 Mon Sep 17 00:00:00 2001 From: Chris Freeh Date: Sat, 17 Jun 2017 01:41:02 -0700 Subject: [PATCH] fix call to microtime (#1) the previous incantation would cast the `microtime()` output to `int` before multiplying, which only allowed for 1-second resolution (the last three digits of `$now` were always zero) casting to `int` after multiplying allows the intended millisecond resolution --- src/Ulid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ulid.php b/src/Ulid.php index c33eee9..af2e30e 100644 --- a/src/Ulid.php +++ b/src/Ulid.php @@ -53,7 +53,7 @@ private function __construct($time, $randomness) */ public static function generate() { - $now = (int) microtime(true) * 1000; + $now = intval(microtime(true) * 1000); $duplicateTime = $now === static::$lastGenTime; $timeChars = '';