File: api-time.rst

package info (click to toggle)
skyfield 1.53%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,688 kB
  • sloc: python: 14,800; makefile: 278; sh: 41
file content (94 lines) | stat: -rw-r--r-- 2,363 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

======================
 API Reference — Time
======================

See the `time` guide for a careful and detailed discussion
of the several time scales used by astronomers,
and of how you can convert time to and from familiar time scales
like UTC and the worldwide time zones that are adapted from it.

.. _calendar date:

Calendar date
=============

1. When building a `Time` from a calendar date,
   you can not only designate a single moment by its time and date,
   but you can also build a `Time` representing a whole array of moments
   by supplying a Python list or NumPy array
   for either the year, month, day, hour, minute, or second.
   See `date-arrays`.

2. By default,
   Skyfield uses the modern Gregorian calendar for all dates —
   even dates before the Gregorian calendar was introduced in 1582.

3. You can instead opt to use the old Julian calendar for ancient dates,
   which is the most common practice among historians.
   See `choice of calendars`.

Timescale, for building and converting times
============================================

.. currentmodule:: skyfield.timelib

.. autoclass:: Timescale
   :members:

The Time object
===============

.. autoclass:: Time
   :members:

   Four basic floating-point values
   can be directly accessed as attributes:

   .. attribute:: tai

      International Atomic Time (TAI) as a Julian date.

   .. attribute:: tt

      Terrestrial Time (TT) as a Julian date.

   .. attribute:: J

      Terrestrial Time (TT) as a floating point number of Julian years.

   .. attribute:: tdb

      Barycentric Dynamical Time (TDB) as a Julian date.

   .. attribute:: ut1

      Universal Time (UT1) as a Julian date.

   Two standard differences between time scales
   are also available as attributes:

   .. attribute:: delta_t

      The difference TT − UT1 measured in seconds.

   .. attribute:: dut1

      The difference UT1 − UTC measured in seconds.

   All of the other ways of expressing the time
   and converting it to typical human systems
   like UTC and world time zones
   are offered through methods:

.. _datetime: https://docs.python.org/3.5/library/datetime.html#datetime.datetime
.. _pytz: http://pythonhosted.org/pytz/

Time utilities
==============

.. testsetup::

    from skyfield.timelib import compute_calendar_date

.. autofunction:: compute_calendar_date