Skip to main content

No project description provided

Project description

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,
    )
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nano_duration-2.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nano_duration-2.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file nano_duration-2.0.1.tar.gz.

File metadata

  • Download URL: nano_duration-2.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for nano_duration-2.0.1.tar.gz
Algorithm Hash digest
SHA256 03da5cc236aa620be35b084edc6dc36e913b7e7b780d2d76edfedc2da2f7915b
MD5 2fb77f837d21198dc3608a407a5ede8c
BLAKE2b-256 e9bead7ac8f2c14b585eb0353d609aacd94f8980adbcda7d2e3a972f3fe4eb05

See more details on using hashes here.

File details

Details for the file nano_duration-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: nano_duration-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for nano_duration-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77ae24f498998dd4efdccbb7f83617b84f8d5b31c5ee09175ea451bded3f901c
MD5 1a9765aad91c473875c42ab810f64d64
BLAKE2b-256 c875a4879a5bb48d4b4cb6e10f4d0eb41584a5aa265b9b923ecdddf224d7ed13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page