From bf7e58dba9d76dd68903c7f8b5bd18b807f2b1e7 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 16 Dec 2016 21:59:06 -0500 Subject: [PATCH] Add EVE date to footer. --- calefaction/eve/__init__.py | 6 ++++++ calefaction/eve/clock.py | 13 +++++++++++++ templates/_base.mako | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 calefaction/eve/clock.py diff --git a/calefaction/eve/__init__.py b/calefaction/eve/__init__.py index a9e90e1..948a19f 100644 --- a/calefaction/eve/__init__.py +++ b/calefaction/eve/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from .clock import Clock from .image import ImageServer __all__ = ["EVE"] @@ -7,8 +8,13 @@ __all__ = ["EVE"] class EVE: def __init__(self): + self._clock = Clock() self._image = ImageServer() @property + def clock(self): + return self._clock + + @property def image(self): return self._image diff --git a/calefaction/eve/clock.py b/calefaction/eve/clock.py new file mode 100644 index 0000000..883721f --- /dev/null +++ b/calefaction/eve/clock.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from datetime import datetime + +__all__ = ["Clock"] + +YEAR_DELTA = 1898 + +class Clock: + + def now(self): + dt = datetime.utcnow() + return str(dt.year - YEAR_DELTA) + dt.strftime("-%m-%d %H:%M") diff --git a/templates/_base.mako b/templates/_base.mako index c670b92..3457007 100644 --- a/templates/_base.mako +++ b/templates/_base.mako @@ -44,6 +44,8 @@ <%block name="footer">