Timezone offset incorrect when reading from database

Hello dear community,

i am currently developing a custom icingaweb2 module.
For this module i used the build-in database functionality to read data about hosts.
The error im facing is occuring when reading data from my database, which has (amongst other data) a start and end time in it.
For some reason, certain hosts have the wrong timezone offset applied when reading the data.
Please see the following example to understand the problem:

This is the data i am reading from my database:

*************************** 1. row ***************************
id: 1234
icinga_object_id: 1234
output: <Timeout exceeded.><Terminated by signal 9 (Killed).>
starttime: 2020-03-23 16:30:11
endtime: 2020-04-27 14:48:37
host_id: 1234
service_id: NULL
duration: 3017906

This is the data my plugin is showing

As you can see, the start time is shown as 17:30* while in the database it is saved as 16:30*.
The end time is shown correctly.
Could this maybe be a bug? I have not seen any default icinga view that shows multiple datetime objects. Maybe there could be an issue with that?

The database connection gets initialized like this:

private $connectionParams = array(
'username' => DB_USER,
'password' => DB_PASSWORD,
'host' => DB_HOST,
'dbname' => DB_NAME,
'charset' => 'utf8'
);

public function __construct()
{
  $this->initDb();
}

private function initDb()
{
  $this->configObject = new ConfigObject($this->connectionParams);
  $this->connection = new DbConnection($this->configObject);
}

I am building the query / fetching the data like this:

public function buildQuery($limit, $sort, $order, $page)
{
try {
    $this->dbq =
    new class($this->connection) extends \Icinga\Data\Db\DbQuery {
      public function addFilter(Filter $filter)
      {
          return parent::addFilter(clone $filter);
      }
    };
    $this->dbq->from(
      DB_NAME . '.table1',
      $this->getSelectedColumns('table1')
    )
    ->join(
      DB_NAME . '.hosts',
      DB_NAME . '.table1.host_id = ' . DB_NAME . '.hosts.id',
      array(
        'host_name'
      )
    )
    ->where('service_id IS NULL');
  $this->dbq
    ->limit($limit, ($page > 1) ? ($page - 1) * $limit : 0)
    ->order($this->getOrderForSort($sort, $order), ($sort == 'starttime' || $sort == 'endtime') ? 'ASC' : 'DESC');
  return $this->dbq
} catch (\Exception $e) {
  var_dump($e->getMessage());
}
return null;
}

Fetching the data like this:

$this->dbq->query($hostQuery);
$hosts = $hostQuery->fetchAll();

The strangest part is, that this only happens to a few hosts.
There are a lot of hosts in the database and i have only seen this problem occuring for a few hosts.

Changing the timezone setting in icinga does affect the datetime objects, so it it working, but even changing the times, the wrong base offset is still present.

The error also is not coming from me changing something in the view, as a var_dump of the object when fetched from the database is already showing the wrong start time.

I am glad for every possible solution or any help at all.

Best regards,
Michel W.

I could not solve this Problem until now, does anyone have any idea what could cause this problem?

Sadly, i still cannot solve this issue.
Just a quick update, i will try to build raw sql queries for the corresponding entries, but i think this is a bug in the icinga database functionality, so any input would be appreciated.