世界时
定义为平太阳相对于格林尼治子午面的时角加12小时,以地球自转周期为基准。世界时区分为UT0,UT1,UT2。
UT0是直接观测得到的;
UT1是UT0加上极移改正得到的;
UT2是UT1加上季节性变化。
年月日时分秒转GPST
GPS所采用的是原子时秒长,起点为1980年1月6日的UTC0时。
在GPS应用中,时常需要采用GPS时间,格式为GPS周+GPS周内秒,从RINEX格式文件中读取的时间均为
格里高利时(年月日时分秒),所以需要进行时间从格里高利时-儒略日-GPS时间转换的过程。
long YMDHMStoJD(YMDHMS time1);
GPSTime JDtoGPSTime(long time2);
typedef struct{
long year;
long month;
long day;
long hour;
long min;
double sec;
} YMDHMS;
typedef struct{
long GPSWeek;
double secsOfWeek;
} GPSTime;
long YMDHMStoJD(YMDHMS time1)
{
int m,y;
long JD;
if(time1.month<=2)
{
y=time1.year+1;
m=time1.month+12;
}
else if(time1.month>2)
{
y=time1.year;
m=time1.month;
}
JD=365.25*y+30.6001*(m+1)+time1.day+1720981.5+time1.hour/24+time1.min/1440+time1.sec/86400;
return JD;
}
GPSTime JDtoGPSTime(long time2)
{
GPSTime gpst;
gpst.GPSWeek=(time2-2444244.5)/7;
gpst.secsOfWeek=((time2-2453736.5)/7-gpst.GPSWeek)*604800;
return gpst;
}
参考:https://blog.csdn.net/weixin_41498178/article/details/79208315?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.compare&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.compare