Index: src/gnuboat/common/device/rrdhandler.py
===================================================================
--- src/gnuboat/common/device/rrdhandler.py	(revision 654d46f729189b319e79cee17ab79a8787c87fa4)
+++ src/gnuboat/common/device/rrdhandler.py	(revision 654d46f729189b319e79cee17ab79a8787c87fa4)
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+'''
+    Copyright (C) 2016 - 2020 EngSaS - Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+'''
+
+import rrdtool
+import os
+import traceback
+
+import gnuboat.common.device.rrdschema as rrdschema
+
+
+def rrd_create_database(database_file, logperiod, start_time='N'):
+    rrd_data_sources = [
+        'DS:latitude:GAUGE:15:-90:90', 'DS:longitude:GAUGE:15:-180:180',
+        'DS:speedthroughwater:GAUGE:15:U:U', 'DS:speedoverground:GAUGE:15:U:U',
+        'DS:courseoverground:GAUGE:15:U:U', 'DS:waterdepth:GAUGE:15:0:10000',
+        'DS:watertemperature:GAUGE:15:-10:50', 'DS:gpsfix:GAUGE:15:-999:3'
+    ]
+
+    step = logperiod
+    # durations: each archive should contain values for in seconds
+    archives = rrdschema.archives
+    rrd_archives = []
+    for i in range(0, len(archives)):
+        rrd_archives += [
+            'RRA:AVERAGE:0.5:{:d}:{:d}'.format(
+                _steps(archives[i].resolution, step),
+                _rows(
+                    archives[i].duration, archives[i].resolution, step
+                )
+            )
+        ]
+
+    if not os.path.isfile(database_file):
+        rrdtool.create(
+            database_file, "--start", start_time, "--step", str(step),
+            rrd_data_sources, rrd_archives
+        )
+
+
+def rrd_update(rrdfile, value_string):
+    try:
+        rrdtool.update(rrdfile, value_string)
+    except:
+        print(
+            'Failed to update rrd database {} with values\n  {}'.format(
+                rrdfile, value_string
+            )
+        )
+        print(traceback.format_exc())
+
+
+def _rows(duration, resolution, step):
+    return int(
+        round(float(duration) / _steps(resolution, float(step)) / float(step))
+    )
+
+
+def _steps(resolution, step):
+    return int(round(float(resolution) / float(step)))
Index: src/gnuboat/common/device/rrdschema.py
===================================================================
--- src/gnuboat/common/device/rrdschema.py	(revision bdd51ecad039b17731c90c94038b71e367d9b674)
+++ src/gnuboat/common/device/rrdschema.py	(revision 654d46f729189b319e79cee17ab79a8787c87fa4)
@@ -18,4 +18,5 @@
 try:
     from dataclasses import dataclass
+
     @dataclass
     class RrdArchive:
