49 lines
748 B
PHP
49 lines
748 B
PHP
<?php
|
|
logger(DEBUG,"Including utils.php");
|
|
|
|
function bool2string($var)
|
|
{
|
|
if ($var === false)
|
|
{
|
|
return "false";
|
|
}elseif($var === true)
|
|
{
|
|
return "true";
|
|
}else
|
|
{
|
|
return $var;
|
|
}
|
|
}
|
|
|
|
function now()
|
|
{
|
|
$now = new datetime();
|
|
return $now;
|
|
}
|
|
|
|
function farenheit2celsius($value)
|
|
{
|
|
return ($value - 32 / 1.8);
|
|
}
|
|
|
|
function millibars($value)
|
|
{
|
|
return ($value * 0.029530);
|
|
}
|
|
|
|
function mktopic($device)
|
|
{
|
|
return $device->topic . "/" . $device->friendlyName;
|
|
}
|
|
|
|
logger(DEBUG, _("signal handling"), false);
|
|
//signal handling
|
|
function signalHandler($signal)
|
|
{
|
|
endMoha();
|
|
}
|
|
pcntl_signal(SIGTERM, 'signalHandler');// Termination ('kill' was called)
|
|
pcntl_signal(SIGHUP, 'signalHandler'); // Terminal log-out
|
|
pcntl_signal(SIGINT, 'signalHandler');
|
|
?>
|