Skip to content

Commit

Permalink
add some more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jan 23, 2024
1 parent 58e44a5 commit ed5026e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Added

- Added `ByteFieldU64` variant.
- Added `spacepackets.countdown` utility module. This class was moved from
`tmtccmd.util.countdown` and contains the `Countdown` class. It was moved here so it can
be re-used more easily.

# [v0.22.0] 2023-12-22

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ Currently, this includes the following components:

It also contains various helper modules

- `PusVerificator` module to track the verification of sent telecommands
- [PTC and PFC definitions](https://spacepackets.readthedocs.io/en/latest/api/ecss.html#module-spacepackets.ecss.fields) for ECSS packets
- `PusVerificator` module to track the verification of sent telecommands.
- [PTC and PFC definitions](https://spacepackets.readthedocs.io/en/latest/api/ecss.html#module-spacepackets.ecss.fields) for ECSS packets.
- `Countdown` utility class.

# Install

Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ This package also uses the :py:mod:`logging` package to emit warnings.
api/cfdp_pdu
api/cfdp_tlv
api/uslp
api/countdown
api/util
7 changes: 7 additions & 0 deletions docs/api/countdown.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Countdown Module
================

.. automodule:: spacepackets.countdown
:members:
:undoc-members:
:show-inheritance:
6 changes: 3 additions & 3 deletions docs/api/util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Utility Module
================

.. automodule:: spacepackets.util
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ It also contains various helper modules

- :py:class:`spacepackets.ecss.pus_verificator.PusVerificator` class to track the verification of sent telecommands
- PTC and PFC definitions for ECSS packets inside the :py:mod:`spacepackets.ecss.fields` module
- :py:class:`spacepackets.countdown.Countdown` utility class

Other pages (online)
---------------------
Expand Down
3 changes: 3 additions & 0 deletions spacepackets/countdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@


def time_ms() -> int:
"""Returns the current :py:func:`time.time` as milliseconds."""
return round(time.time() * 1000)


class Countdown:
"""Utility class for counting down time. Exposes a simple API to initiate
it with an initial timeout and to check whether is has expired."""
def __init__(self, init_timeout: Optional[timedelta]):
if init_timeout is not None:
self._timeout_ms = int(init_timeout / timedelta(milliseconds=1))
Expand Down

0 comments on commit ed5026e

Please sign in to comment.