Skip to content

Commit

Permalink
Merge pull request #233 from mueslo/patch-1
Browse files Browse the repository at this point in the history
add initial start time of progress
  • Loading branch information
wolph authored Aug 29, 2020
2 parents 9eb0bbe + e1884d4 commit a6ccd73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion progressbar/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def __init__(self, min_value=0, max_value=None, widgets=None,
self.value = initial_value
self._iterable = None
self.custom_len = custom_len
self.initial_start_time = kwargs.get('start_time')
self.init()

# Convert a given timedelta to a floating point number as internal
Expand Down Expand Up @@ -758,7 +759,9 @@ def start(self, max_value=None, init=True):
if self.max_value is not base.UnknownLength and self.max_value < 0:
raise ValueError('max_value out of range, got %r' % self.max_value)

self.start_time = self.last_update_time = datetime.now()
now = datetime.now()
self.start_time = self.initial_start_time or now
self.last_update_time = now
self._last_update_timer = timeit.default_timer()
self.update(self.min_value, force=True)

Expand Down

0 comments on commit a6ccd73

Please sign in to comment.