Exemple #1
0
 def __init__(self, rangechecks=True):
     self.rangechecks = rangechecks
     ds1302.init_clock()
Exemple #2
0
import sys

import MySQLdb

#VERIFICANDO DATA DO SISTEMA

f = open('rtc.log', 'a')
sys.stdout = f

print "> Sistema iniciado"

o = commands.getoutput("date -Ins ")

y, m, d, h, mi, s = o[0:4], o[5:7], o[8:10], o[11:13], o[14:16], o[17:19]

ds1302.init_clock()

for i in range(10):
    year, month, day = ds1302.get_date()
    hour, minute, second = ds1302.get_time()
    if (month > 12): month = 0
    if (day > 31): day = 0
    if (hour > 24): hour = 0
    if (minute > 60): minute = 0
    if (second > 60): second = 0
    if (int(mi) < minute or int(h) < hour or int(d) < day or int(m) < month):
        print ">>> Atualizando data"
        os.system("date -s " + str(year) + "/" + str(month) + "/" + str(day))
        os.system("date -s " + str(hour) + ":" + str(minute) + ":" +
                  str(second))
        o = commands.getoutput("date -Ins ")
	def __init__(self, rangechecks=True):
		self.rangechecks = rangechecks
		ds1302.init_clock()