configd: Jinja helper function to show current iso timestamp in local timezone. closes https://github.com/opnsense/core/issues/5341

At the moment further refactoring of the template code is likely not needed, let's keep the helper functions statically in template_helpers.py for now
This commit is contained in:
Ad Schellevis 2023-04-29 17:30:45 +02:00
parent 2850c263c8
commit 368e7ac15e

View File

@ -25,6 +25,7 @@
"""
import os
import datetime
import glob
import collections
import netaddr
@ -142,6 +143,13 @@ class Helpers(object):
"""
return netaddr.IPNetwork(network)
@staticmethod
def getUtcTime():
""" return UTC timestamp in ISO 8601 format with second granularity
:return: string
"""
return datetime.datetime.utcnow().astimezone().isoformat(timespec="seconds")
@staticmethod
def sortDictList(lst, *operators):
if type(lst) == list: