1 from __future__
import print_function
2 import os,sys,time,calendar
3 from datetime
import datetime,timedelta
26 given a orbit number, return its corresponding time. Assuming begin time has orbit=0 30 def OrbitToTime(self,begStrTime,orbitnumber,begorbit=0,customfm=''):
32 given a orbit number, return its corresponding time. Default run begin time counting from orbit=0 38 given a orbit number, return its corresponding unixtimestamp. Default run begin time counting from orbit=0 40 os.environ[
'TZ']=
'CET' 42 orbittime=self.
OrbitToTime(begStrTime,orbitnumber,begorbit=begorbit,customfm=customfm)
43 return time.mktime(orbittime.timetuple())+orbittime.microsecond/1e6
47 given a orbit number, return its corresponding unixtimestamp. Default run begin time counting from orbit=0 49 os.environ[
'TZ']=
'UTC' 51 orbittime=self.
OrbitToTime(begStrTime,orbitnumber,begorbit=begorbit,customfm=customfm)
52 return time.mktime(orbittime.timetuple())+(orbittime.microsecond/1e6)
54 '''convert string timestamp to python datetime 61 result=datetime.strptime(strTime,customfm)
62 except Exception
as er:
66 '''convert python datetime to string timestamp 73 result=timeValue.strftime(customfm)
74 except Exception
as er:
77 if __name__==
'__main__':
78 begTimeStr=
'03/30/10 10:10:01' 80 print(
'orbit 0 : ',c.OrbitToTime(begTimeStr,0,0))
81 print(
'orbit 1 : ',c.OrbitToTime(begTimeStr,1,0))
82 print(
'orbit 262144 : ',c.OrbitToTime(begTimeStr,262144,0))
83 print(
'orbit 0 : ',c.OrbitToUTCTimestamp(begTimeStr,0,0));
84 print(
'orbit 0 : ',c.OrbitToLocalTimestamp(begTimeStr,0,0));
def DatetimeToStr(self, timeValue, customfm='')
def OrbitToTime(self, begStrTime, orbitnumber, begorbit=0, customfm='')
def OrbitToUTCTimestamp(self, begStrTime, orbitnumber, begorbit=0, customfm='')
def OrbitDuration(self, norbits=1)
S & print(S &os, JobReport::InputFile const &f)
def OrbitToLocalTimestamp(self, begStrTime, orbitnumber, begorbit=0, customfm='')
def StrToDatetime(self, strTime, customfm='')
def OrbitToTimeStr(self, begStrTime, orbitnumber, begorbit=0, customfm='')
def LSDuration(self)
return datetime.fromtimestamp(ts,tz=pytz.utc) return datetime.utcfromtimestamp(ts) ...