From 03ff19b05a215bf6692be66de15e818d19cc5e26 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Sun, 9 Jan 2011 23:54:08 +0100 Subject: [PATCH] one more correction --- lib/Interpreter/MeterInterpreter.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Interpreter/MeterInterpreter.php b/lib/Interpreter/MeterInterpreter.php index 15451d3..9140b10 100644 --- a/lib/Interpreter/MeterInterpreter.php +++ b/lib/Interpreter/MeterInterpreter.php @@ -43,7 +43,7 @@ class MeterInterpreter extends Interpreter { public function getConsumption() { $sql = 'SELECT COUNT(*) FROM `data` WHERE `channel_id` = ' . $this->channel->getId() . parent::buildDateTimeFilterSQL($this->from, $this->to); - return $this->conn->fetchColumn($sql, array($this->channel->getId()), 0)*$this->channel->getProperty('resolution'); // return Wh + return $this->conn->fetchColumn($sql, array($this->channel->getId()), 0)*$this->channel->getProperty('resolution'); // return KWh } /** @@ -83,7 +83,8 @@ class MeterInterpreter extends Interpreter { * @todo reimplement according to new env */ public function getAverage() { - return round(3600*1000*$this->getConsumption() / ($this->to - $this->from), 10); // return W + return round(3600*1000*1000*$this->getConsumption() / ($this->to - $this->from), 10); // return W + // 3600: 3600 s/h; 1000: ms -> s; 1000: KW -> W } /**