Skip to content

Commit

Permalink
Fix timestamp generation
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Mar 10, 2019
1 parent 50e1c1f commit 0d311b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Interpreter/Interpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,13 @@ protected function getData() {
$this->from = (double)$from; // bigint conversion
}
if (isset($this->to)) {
$sql = 'SELECT MIN(timestamp) FROM data WHERE channel_id=? AND timestamp>?';
/*
// $sql = 'SELECT MIN(timestamp) FROM data WHERE channel_id=? AND timestamp>?';
// avoid generating timestamps outside the requested range for consumption
$sql = ($this->hasOption('consumption') || $this->hasOption('consumptionto'))
? 'SELECT MAX(timestamp) FROM data WHERE channel_id=? AND timestamp<?'
: 'SELECT MIN(timestamp) FROM data WHERE channel_id=? AND timestamp>?';
*/
$to = $this->conn->fetchColumn($sql, array($this->channel->getId(), $this->to), 0);

$to = $this->conn->fetchColumn($sql, array($this->channel->getId(), $this->to), 0);
if ($to)
$this->to = (double)$to; // bigint conversion
}
Expand Down

0 comments on commit 0d311b0

Please sign in to comment.