Example #1
0
 def openDB(self):
     self.db = myDB.use('graphs')
     self.DB = self.db.cursor()
Example #2
0
#!/home/scripts/venv/python3/bin/python3
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
#
import sys
import syslog
import time
import datetime

import string
sys.path.append('/home/scripts/libs')
import myDB

yesterday = datetime.datetime.now() - datetime.timedelta(days=1)
db = myDB.use('graphs')
DB = db.cursor()


def time2sec(time):
    return sum(
        [a * b for a, b in zip([3600, 60, 1], map(int, time.split(':')))])


def time2interval(time):
    secs = time2sec(time)
    interval = 1800
    intervalN = secs // interval
    intervalW = round(float(secs % interval) / interval, 4)
    #print secs % interval
    #print (str(intervalWeight) + 'ss' + str(secs))
    return [intervalN, intervalW]
Example #3
0
 def openDB(self):
     self.db = myDB.use('sensors')
     self.DB = self.db.cursor()