28 lines
673 B
Python
28 lines
673 B
Python
|
"""
|
||
|
An example showing off the current D'Ni time and it's conversion back to an
|
||
|
Earth datetime.
|
||
|
"""
|
||
|
|
||
|
from datetime import datetime
|
||
|
import sys
|
||
|
from time import sleep
|
||
|
|
||
|
from dnidatetime import DniDatetime
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
while True:
|
||
|
try:
|
||
|
earth_now = datetime.now().astimezone()
|
||
|
dni_now = DniDatetime.from_earth(earth_now)
|
||
|
back = dni_now.to_earth().astimezone()
|
||
|
print(
|
||
|
f"{earth_now} --> {dni_now} --> {back}",
|
||
|
end=" \r",
|
||
|
flush=True,
|
||
|
)
|
||
|
sleep(0.01)
|
||
|
except KeyboardInterrupt:
|
||
|
print("\n")
|
||
|
sys.exit()
|