Commit 6f321946 authored by Jérome Perrin's avatar Jérome Perrin

TimeSupportMixin: add convertToFormattedRealWorldTime helper method

parent 78563e5d
......@@ -40,6 +40,12 @@ class TimeSupportMixin(object):
assert self.initialized, "initializeTimeSupport has not been called"
return self.now + timedelta(days=simulation_time/self.timeUnitPerDay)
def convertToFormattedRealWorldTime(self, simulation_time):
"""Convert simulation clock time to real world time, as string formatted according to general dateFormat
"""
assert self.initialized, "initializeTimeSupport has not been called"
return (self.now + timedelta(days=simulation_time/self.timeUnitPerDay)).strftime(self.dateFormat)
def convertToTimeStamp(self, simulation_time):
"""Convert simulation clock time to real world time, as timestamp.
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment