Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for callback clock #76

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Change Log
Unreleased_
-----------

N/A
Fixed
~~~~~

- Since version 1.0, the value passed to ``SpaceTrackClient.callback``, if set,
is from `time.monotonic()` but the documentation was not updated to reflect
this.

1.1.0_ - 2023-10-15
-------------------
Expand Down
7 changes: 3 additions & 4 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ The client will ensure that no more than 19 HTTP requests are sent per minute
by sleeping if the rate exceeds this. This will be logged to the spacetrack
module's logger. You can register a callback with the
:class:`~spacetrack.base.SpaceTrackClient` or
:class:`~spacetrack.aio.AsyncSpaceTrackClient` classes. It will be passed the
time that the module is sleeping until, in seconds since the epoch (as with
:func:`time.time`).
:class:`~spacetrack.aio.AsyncSpaceTrackClient` classes. It will be passed a
value to be compared against :func:`time.monotonic` to get the remaining time:

.. code-block:: python

Expand All @@ -139,7 +138,7 @@ time that the module is sleeping until, in seconds since the epoch (as with
from spacetrack import SpaceTrackClient

def mycallback(until):
duration = int(round(until - time.time()))
duration = int(round(until - time.monotonic()))
print('Sleeping for {:d} seconds.'.format(duration))

st = SpaceTrackClient(identity='[email protected]', password='password')
Expand Down