~xenrox/status-display

302b621b1cadf06ef28c56f15db17fa771f7d479 — Thorben Günther 3 years ago c59ba68
Add module for time and date.
2 files changed, 21 insertions(+), 2 deletions(-)

A modules/timestamp.py
M test.py
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