Skyfield time arithmetic
See original GitHub issueHi,
I am trying to compute B: skyfield.Date
that is a minute before A: skyfield.Date
.
How should I go about this?
I tried using datetime.timedelta
to represent one minute and subtract it, but it is not supported.
from skyfield.api import load
from datetime import timedelta
ts = load.timescale()
A = ts.now()
B = A - datetime.timedelta(minutes=1) #TypeError: unsupported operand type(s) for -: 'Time' and 'datetime.timedelta'
I couldn’t find a good way to do this in the examples or in the source of skyfield.timelib
(timelib.py
). Any idea?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Dates and Time — Skyfield documentation - Rhodes Mill
Date arithmetic becomes very simple as we leave UTC behind and consider completely uniform time scales. Days are always 24 hours, hours always...
Read more >Adding a timedelta to a skyfield Time - python - Stack Overflow
What if I just wanted to use one (start) date and set the next date to be exactly one day after? I can't...
Read more >How to convert skyfield Time into datetime at specific timezone
When you have a skyfield Time object like. convert-skyfield-time-into-datetime-at-specific-timezone.py 📋 Copy to clipboard⇓ Download.
Read more >The Art of Time-Keeping, Part 1: Years and Dates - Quantum
It proves awfully convenient for time-based arithmetic, ... I was able to find algorithms in the Python library skyfield that works for ...
Read more >Python timescale Examples
t = Time('1980-03-25 00:00') location = None # skyfield ephemeris planets = load('de421.bsp') ts = load.timescale() mercury, jupiter, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, you should get good results if you subtract
1.0 / 24 / 60
from the Terrestrial Time. Something like:By the way, were the
:
characters in your sample code your own notation, or part of a framework you’re using? They didn’t work when I tried them in the version of Python on this laptop.these are python 3 type declarations (available from python 3.5/3.6): https://docs.python.org/3/library/typing.html thanks for the hint. We can close this now.