Permalink
Browse files

adding internet time

  • Loading branch information...
1 parent b6e5530 commit 732251ebad8d0cf18fbfc3e532ae8d7baec65441 @phooky phooky committed Nov 6, 2013
Showing with 15 additions and 2 deletions.
  1. +15 −2 hexaservice/service.py
View
@@ -10,6 +10,17 @@
debug = False
+
+
+def internet_time():
+ "Swatch Internet Time. Biel meridian."
+ h, m, s = time.gmtime()[3:6]
+ h += 1 # Biel time zone: UTC+1
+ seconds = s + (60.0*m) + (60.0*60.0*h)
+ beats = s * 1000.0 / (60.0*60.0*24.0)
+ beats = beats % 1000.0
+ return beats
+
class PanelThread(threading.Thread):
def __init__(self, panel):
pass
@@ -38,9 +49,11 @@ def sigint_handler(signal,frame):
txtimg = base_font.strImg(msg)
img = Image.new("1",(120,7))
img.paste(txtimg,(15,0))
- img.paste(txtimg,(75,0))
+ bmsg = "{0:3.2} .beats".format(internet_time())
+ txt2img = base_font.strImg(bmsg)
+ img.paste(txt2img,(70,0))
bitmap = compile_image(img,0,0)
-
+
for j in range(3):
panels[j].setCompiledImage(bitmap)
time.sleep(0.1)

0 comments on commit 732251e

Please sign in to comment.