Skip to content

Commit

Permalink
remove dependence on traditional time module
Browse files Browse the repository at this point in the history
  • Loading branch information
jlnav committed Dec 11, 2019
1 parent 867580c commit 00b07f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libensemble/util/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
libensemble utility class -- manages timer
"""

import time
import datetime


Expand Down Expand Up @@ -45,12 +44,14 @@ def __str__(self):
@property
def date_start(self):
"""Return a string representing the start datetime."""
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(self.tstart / 1000)) + '.' + str(self.tstart)[-3:]
start_time = datetime.date.fromtimestamp(self.tstart / 1000)
return start_time.strftime("%Y-%m-%d %H:%M:%S") + '.' + str(self.tstart)[-3:]

@property
def date_end(self):
"""Return a string representing the end datetime."""
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(self.tend / 1000)) + '.' + str(self.tend)[-3:]
end_time = datetime.date.fromtimestamp(self.tend / 1000)
return end_time.strftime("%Y-%m-%d %H:%M:%S") + '.' + str(self.tend)[-3:]

@property
def elapsed(self):
Expand Down

0 comments on commit 00b07f8

Please sign in to comment.