Go to the documentation of this file.
2 Module to hold time utility classes and functions.
5 from datetime
import datetime, timezone, timedelta
10 Returns a day of year computed from the provided month (mon parameter),
11 day of month(dom parameter), and year (yr parameter).
13 date_obj = datetime(
int(yr),
int(mon),
int(dom))
14 doy = date_obj.timetuple().tm_yday
19 Return the number of elapsed leap seconds given a TAI time in seconds
25 epochsecs = (datetime(epochyear,1,1,0,0,0,tzinfo=timezone.utc) - datetime(1970,1,1,0,0,0,tzinfo=timezone.utc)).total_seconds()
26 taidt = datetime.utcfromtimestamp(taitime + epochsecs)
27 taiutc = os.path.join(os.environ[
'OCVARROOT'],
'common',
'tai-utc.dat')
29 with open(taiutc,
"r")
as tdat:
31 rec = line.rstrip().split(
None, 7)
32 dt = julian.from_jd(
float(rec[4]))
34 leapsec =
float(rec[6])
def convert_month_day_to_doy(mon, dom, yr)
def get_leap_seconds(taitime, epochyear=1958)