Moved the packing of XML tree into NWTree, and added a function for formatting time stamps

This commit is contained in:
Veronica K. B. Olsen
2020-05-09 13:08:11 +02:00
parent 6cdf203079
commit d44dca6a21
5 changed files with 72 additions and 40 deletions
+10
View File
@@ -28,6 +28,10 @@
import logging
import nw
from datetime import datetime
from nw.constants import nwConst
logger = logging.getLogger(__name__)
def checkString(checkValue, defaultValue, allowNone=False):
@@ -122,6 +126,12 @@ def formatInt(theInt):
return "%d" % theInt
def formatTimeStamp(theTime, fileSafe=False):
if fileSafe:
return datetime.fromtimestamp(theTime).strftime(nwConst.fStampFmt)
else:
return datetime.fromtimestamp(theTime).strftime(nwConst.tStampFmt)
def splitVersionNumber(vString):
""" Splits a version string on the form aa.bb.cc into major, minor
and patch, and computes an integer value aabbcc.