资源简介
卫星时间系统转换程序:GPST, MJD,COMMONT
代码片段和文件信息
//------------------------------------------------------------------------------
//
// SAT_Time.cpp
//
// Purpose:
//
// Time and date computation
//
// Notes:
//
// This software is protected by national and international copyright.
// Any unauthorized use reproduction or modificaton is unlawful and
// will be prosecuted. Commercial and non-private application of the
// software in any form is strictly prohibited unless otherwise granted
// by the authors.
//
// The code is provided without any warranty; without even the implied
// warranty of merchantibility or fitness for a particular purpose.
//
// Last modified:
//
// 2000/03/04 OMO Final version (1st edition)
// 2001/08/17 OMO Minor upgrades
//
// (c) 1999-2001 O. Montenbruck E. Gill
//
//------------------------------------------------------------------------------
#include
#include
#include
#include “SAT_Time.h“
#include “GNU_iomanip.h“
using namespace std;
//------------------------------------------------------------------------------
//
// Mjd
//
// Purpose:
//
// Modified Julian Date from calendar date and time
//
// Input/output:
//
// Year Calendar date components
// Month
// Day
// Hour Time components (optional)
// Min
// Sec
// Modified Julian Date
//
//------------------------------------------------------------------------------
double Mjd ( int Year int Month int Day int Hour int Min double Sec )
{
// Variables
long MjdMidnight;
double FracOfDay;
int b;
if (Month<=2) { Month+=12; --Year;}
if ( (10000L*Year+100L*Month+Day) <= 15821004L )
b = -2 + ((Year+4716)/4) - 1179; // Julian calendar
else
b = (Year/400)-(Year/100)+(Year/4); // Gregorian calendar
MjdMidnight = 365L*Year - 679004L + b + int(30.6001*(Month+1)) + Day;
FracOfDay = (Hour+Min/60.0+Sec/3600.0) / 24.0;
return MjdMidnight + FracOfDay;
}
//------------------------------------------------------------------------------
//
// CalDat
//
// Purpose:
//
// Calendar date and time from Modified Julian Date
//
// Input/output:
//
// Mjd Modified Julian Date
// Year Calendar date components
// Month
// Day
// Hour Time components
// Min
// Sec
//
//------------------------------------------------------------------------------
void CalDat ( double Mjd
int& Year int& Month int& Day
int& Hour int& Min double& Sec )
{
// Variables
long abcdef;
double Hoursx;
// Convert Julian day number to calendar date
a = long(Mjd+2400001.0);
if ( a < 2299161 ) { // Julian calendar
b = 0;
c = a + 1524;
}
else { // Gregorian calendar
b = long((a-1867216.25)/36524.25);
c = a + b - (b/4) + 1525;
}
d = long ( (c-122.1)/365
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4365 2014-05-25 10:19 Sat_Time\SAT_Time.cpp
文件 2590 2014-05-25 10:19 Sat_Time\SAT_Time.h
目录 0 2016-04-01 17:27 Sat_Time
----------- --------- ---------- ----- ----
6955 3
- 上一篇:spring-qutarz_demo
- 下一篇:poster模板
评论
共有 条评论