2015-07-01 14:11:11 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
# -*- coding: cp1252 -*-
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
little Helper functions
|
2015-07-01 14:52:33 +02:00
|
|
|
mainly for direct usw in plugins to save code
|
2015-07-01 14:11:11 +02:00
|
|
|
|
|
|
|
|
@author: Bastian Schroll
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
2015-07-01 14:52:33 +02:00
|
|
|
def curtime(format="%d.%m.%Y %H:%M:%S"):
|
2015-07-01 14:11:11 +02:00
|
|
|
"""
|
2015-07-01 14:52:33 +02:00
|
|
|
Returns formated date and/or time
|
|
|
|
|
see: https://docs.python.org/2/library/time.html#time.strftime
|
2015-07-01 14:11:11 +02:00
|
|
|
|
|
|
|
|
@type format: string
|
|
|
|
|
@param format: Python time Format-String
|
|
|
|
|
|
|
|
|
|
@return: Formated Time and/or Date
|
|
|
|
|
@exception: Exception if Error in format
|
|
|
|
|
"""
|
|
|
|
|
try:
|
|
|
|
|
return time.strftime(format)
|
|
|
|
|
except:
|
|
|
|
|
logging.warning("error in time-format-string")
|
|
|
|
|
logging.debug("error in time-format-string", exc_info=True)
|