世界时 年月日时分秒转GPST

世界时

定义为平太阳相对于格林尼治子午面的时角加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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值