Extended Decimal Time
Project description
Imagine decimal representation of days of UNIX seconds, call it “Epoch Days”.
Then, imagine grouping the digits of such days representation as follows:
dYear ° dMonth ″ dWeek ′ day T dHour : dMinute : dSecond, such that:
1 dYear = 1000 days, 1 dMonth = 100 days, 1 dWeek = 10 days,
1 dHour = 0.1 days, 1 dMinute = 0.001 days, 1 dSecond = 0.00001 days.
Yes, you just divide your UNIX seconds / 86400 and group digits!
Exmaple
For example, 2021-09-30T11:25:45Z would be represented as 1633001147 UNIX seconds, therefore: 1633001147/86400 = 18900.476238425927 = 18°9″0′0T4:76:23.8425927, meaning it is 18th dYear, 9th dMonth, 0th dWeek, 0th day, 4th dHour, 76th dMinute, 23.8425927th dSecond.
Usage
pip install edtime
>>> from edtime import edtime
>>> from datetime import datetime
>>> t0 = edtime(datetime.utcnow()) # OR edtime.utcnow()
>>> t1 = edtime.datetime(2021, 12, 20, 4, 52, 47, 954297)
>>> str(t1)
'18°9″8′1T2:03:33.2804365'
>>> float(t1)
18981.203332804365
>>> t2 = edtime(18981.203332804365); t2
edtime.edtime(dyear=18, dmonth=9, dweek=8, dday=1, dhour=2, dminute=3, dsecond=33.2804365)
>>> t1 == t2
True
>>> t3 = edtime(16, 4, 5, 3, 4, 65, 40.5092593); t3 # 2015-01-18T11:10:11
edtime.edtime(dyear=16, dmonth=4, dweek=5, dday=3, dhour=4, dminute=65, dsecond=40.5092593)
>>> str(t1 + t2 + t3)
'54°4″1′5T8:72:07.070133'
>>> (t1 + t2 + t3).to_datetime().isoformat()
'2118-12-26T20:55:46.908595'
For astronomers:
ED = JD - 2440587.5
>>> from edtime import edtime
>>> d = edtime.datetime(2000, 1, 1, 12)
>>> d.to_jd()
>>> 2451545.0
>>> float(edtime.from_jd(2451545))
10957.5
Notice
- => 1 dSecond is:
0.864 standard SI seconds long.
- => 1 dMinute is:
86.4 standard SI seconds long.
- => 1 dHour is:
8640 standard SI seconds long.
- => 1 dWeek is:
10 days long.
- => 1 dMonth is:
100 days long.
- => 1 dYear is:
1000 days long.
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
File details
Details for the file edtime-1.0.1.tar.gz
.
File metadata
- Download URL: edtime-1.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edbcf4ca09c4812bc2325b40aa63efbe7aaa110ff4e52e4c715dc93b84af811e |
|
MD5 | 73ba294a4a05a38eb992cbb2d2be0d0a |
|
BLAKE2b-256 | 398fa386493e0abccec23f1b288dc123b66af6385669656b6459f86ee2cca7e6 |