|
|
|
|
|
|
|
2.4
What You Need Date/Time Code to Do |
|
|
|
|
|
|
|
|
You want to do two fundamental things with date/time functions. The first is to relate time to date. The second is to perform calculations with dates. |
|
|
|
|
|
|
|
|
In the first case, you want to know how many seconds are left in the day, how much longer the experiment will run, what fraction of a day is consumed by an activity, and so on. |
|
|
|
|
|
|
|
|
In the second case, you want to know how many days until Christmas, what date the contract expires if it happens 180 days from today, when Easter falls this year, whether Friday the thirteenth falls on a full moon, what date the fourth Thursday in March is, and so on. |
|
|
|
|
|
|
|
|
You also want to be able to relate events in different calendar systems to each other. Performing math in any one calendar system is often difficult and time consuming. Relating two or more of them can be a challenge. |
|
|
|
|
|
|
|
|
In this section, I outline the basic argument for a linear time scale and present the one used in the SCDTL system. |
|
|
|
|
|
|
|
|
Date/time calculations are a problem for two basic reasons: |
|
|
|
|
|
|
|
|
The units are related cyclically, not linearly. January plus 190 days is July, but January plus 365 days is January again. |
|
|
|
|
|
|
|
|
The units are not related by simple metric rules. The number of days in a month is not constant in many calendars. The number of months per year varies in many calendars, and the number of days in a year varies in most calendars. Rules for |
|
|
|
|
| Table 2.3 Planet indices. | | Number, n | Index = n mod 7 | Planet | | 1 | 1 mod 7 = 1 | Saturn | | 25 | 25 mod 7 = 4 | Sun | | 49 | 49 mod 7 = 0 | Moon | | 73 | 73 mod 7 = 3 | Mars | | 97 | 97 mod 7 = 6 | Mercury | | 121 | 121 mod 7 = 2 | Jupiter | | 145 | 145 mod 7 = 5 | Venus |
|
|
|