Skip to content

Commit b551ff4

Browse files
committed
Added microsecond support and microtime default value
1 parent fb8e4e6 commit b551ff4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Entity.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ class Entity
3434
*
3535
* @param $tag
3636
* @param $data
37-
* @param int $time unixtime
37+
* @param int|float $time unixtime with microseconds
3838
*/
3939
public function __construct($tag, $data, $time = null)
4040
{
41-
if (is_long($time)) {
41+
if (is_long($time) || is_float($time)) {
4242
$this->time = $time;
4343
} else {
4444
if (!is_null($time)) {
4545
error_log("Entity::__construct(): unexpected time format `{$time}` specified.");
4646
}
4747

48-
$this->time = time();
48+
$this->time = microtime(true);
4949
}
5050

5151
$this->tag = $tag;
@@ -81,4 +81,4 @@ public function getTime()
8181
{
8282
return $this->time;
8383
}
84-
}
84+
}

0 commit comments

Comments
 (0)