no fraction on timestamp

master
Dirk Heilig 2024-08-14 16:28:23 +02:00
parent 9b489e6e24
commit 7bb9e7f3e7
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<?php <?php
use Mosquitto\Message; use Mosquitto\Message;
define("STARTED", microtime(true)); define("STARTED", time());
$mqttHost = getenv("MQTT_HOST"); $mqttHost = getenv("MQTT_HOST");
if (!$mqttHost) { if (!$mqttHost) {
echo "Please set MQTT_HOST environment variable\n"; echo "Please set MQTT_HOST environment variable\n";
@ -70,7 +70,7 @@ $mqtt->onMessage(function ($message) use (&$data, &$stats, &$news) {
$stats["metrics"][] = time(); $stats["metrics"][] = time();
$payload = (array) json_decode($message->payload, true); $payload = (array) json_decode($message->payload, true);
$payload["timestamp"] = microtime(true); $payload["timestamp"] = time();
$data[] = $payload; $data[] = $payload;
$news = true; $news = true;
}); });
@ -167,7 +167,7 @@ function output(): void
{ {
filter(); filter();
global $data, $stats; global $data, $stats;
$t = microtime(true); $t = time();
$prom = ""; $prom = "";
$prom .= $prom .=