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
Release history Release notifications | RSS feed
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.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for nano_duration-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3d47d76f3271a34c93d607e8a8e2b3a956bc9e0a49df75299c2ac7ac963313f |
|
MD5 | 437d6901bf0fb97dd5e3c21d20e1cef4 |
|
BLAKE2b-256 | ce1a526efdc39757504e2a51af9f2804deebdc9fd3f649e43e16e478835fe350 |