A modules/timestamp.py => modules/timestamp.py +21 -0
@@ 0,0 1,21 @@
+from datetime import datetime
+
+
+def timestamp_str():
+ now = datetime.now()
+ minute = now.minute
+ hour = now.hour
+
+ if 0 <= minute < 8:
+ minute = "00"
+ elif 8 <= minute < 23:
+ minute = "15"
+ elif 23 <= minute < 38:
+ minute = "30"
+ elif 38 <= minute < 53:
+ minute = "45"
+ else:
+ minute = "00"
+ hour += 1
+
+ return now.strftime("%a, %d.%m ") + "{}:{}".format(hour, minute)
M test.py => test.py +0 -2
@@ 1,5 1,3 @@
-import os
-
import driver as epd
from PIL import Image, ImageDraw, ImageFont