Skip to main content

nano_duration: Operations with ISO 8601 durations.

What is this.

ISO 8601 is most commonly known as a way to exchange date-times in textual format. to have more precision duration this package included milliseconds, microseconds, and nanoseconds A lesser-known aspect of the standard is the representation of durations. They have a shape similar to this:

P3Y6M4DT12H30M5S80m90u120n

which symbols defined as blow:

"Y" -> "years"
"M" -> "months"
"D" -> "days"
"H" -> "hours"
"M" -> "minutes"
"S" -> "seconds"
"m" -> "miliseconds"
"u" -> "microseconds"
"n" -> "nanoseconds"

As this module maps ISO 8601 dates/times to standard Python data type.

Parse:

parses an ISO 8601 duration string into Duration object.

from nano_duration import parse

duration = parse("P3Y6M4DT12H24M12S10m80u12n")

Generate:

generate a duration object into ISO 8601 duration string

from nano_duration import Duration, generate

generate(
    Duration(
        years=3,
        months=2,
        days=3,
        hours=5,
        seconds=57,
        miliseconds=8,
        microseconds=30,
        nanoseconds=20,
    )
)

Metadata

Release files for nano-duration 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nano-duration 2.0.1
File Size Uploaded Provenance Actions
nano_duration-2.0.1.tar.gz 3.0 kB Without provenance Details for nano_duration-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nano-duration 2.0.1
File Interpreter ABI Platform Actions
nano_duration-2.0.1-py3-none-any.whl Python 3 none any Details for nano_duration-2.0.1-py3-none-any.whl

Total release size: 7.3 kB

Release files / nano_duration-2.0.1.tar.gz

Download URL nano_duration-2.0.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
03da5cc236aa620be35b084edc6dc36e913b7e7b780d2d76edfedc2da2f7915b
BLAKE2b-256 checksum
How to use checksums
e9bead7ac8f2c14b585eb0353d609aacd94f8980adbcda7d2e3a972f3fe4eb05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / nano_duration-2.0.1-py3-none-any.whl

Download URL nano_duration-2.0.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77ae24f498998dd4efdccbb7f83617b84f8d5b31c5ee09175ea451bded3f901c
BLAKE2b-256 checksum
How to use checksums
c875a4879a5bb48d4b4cb6e10f4d0eb41584a5aa265b9b923ecdddf224d7ed13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Security for nano-duration 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page