Skip to content

Commit

Permalink
allow time_in(CACHE_FOREVER)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jan 20, 2018
1 parent ae38597 commit 2e40c99
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions py3status/py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,23 @@ def time_in(self, seconds=None, sync_to=None, offset=0):
``cached_until`` in their response unless they wish to directly control
it.
seconds specifies the number of seconds that should occure before the
update is required.
:param seconds: specifies the number of seconds that should occure before the
update is required. Passing a value of ``CACHE_FOREVER`` returns
``CACHE_FOREVER`` which can be useful for some modules.
sync_to causes the update to be syncronised to a time period. 1 would
cause the update on the second, 60 to the nearest minute. By defalt we
syncronise to the nearest second. 0 will disable this feature.
:param sync_to: causes the update to be syncronised to a time period. 1 would
cause the update on the second, 60 to the nearest minute. By defalt we
syncronise to the nearest second. 0 will disable this feature.
offset is used to alter the base time used. A timer that started at a
certain time could set that as the offset and any syncronisation would
then be relative to that time.
:param offset: is used to alter the base time used. A timer that started at a
certain time could set that as the offset and any syncronisation would
then be relative to that time.
"""

# if called with CACHE_FOREVER we just return this
if seconds is self.CACHE_FOREVER:
return self.CACHE_FOREVER

if seconds is None:
# If we have a sync_to then seconds can be 0
if sync_to and sync_to > 0:
Expand Down

0 comments on commit 2e40c99

Please sign in to comment.