4 #define CWB_MJD_REF 2400000.5 // Reference Julian Day for Mean Julian Day
29 setenv(
"TZ",
":UTC", 1);
31 if ( mNSec >= 1000000000 ) {
32 mSec +=
INT_4S( mNSec / 1000000000 );
33 mNSec = mNSec % 1000000000;
41 setenv(
"TZ",
":UTC", 1);
52 setenv(
"TZ",
":UTC", 1);
67 if (
this != &time ) {
84 if ( mNSec >= 1000000000 ) {
85 mSec +=
INT_4S( mNSec / 1000000000 );
86 mNSec = mNSec % 1000000000;
100 if ( mNSec >= time.
GetNSec() ) {
104 mNSec += 1000000000 - time.
GetNSec();
117 unsigned long long tmp = d*1000000000;
118 unsigned long long lsec1 = d;
119 unsigned long long lnsec1 = (tmp%1000000000)/100;
120 unsigned long long lsec2 = mSec;
121 unsigned long long lnsec2 = mNSec/100;
123 tmp = lsec1*lsec2*1000000000+(lsec1*lnsec2+lnsec1*lsec2)*100+(lnsec1*lnsec2)/100000;
125 mSec = tmp/1000000000;
126 mNSec = tmp%1000000000;
139 double ns = mNSec / d;
141 mSec =
INT_4S( mSec / d );
142 mNSec = (
INT_4U)( ns+(s-mSec)*1000000000 );
153 return ((1000000000*mSec+mNSec)
173 return !( *
this >
time );
182 return !( *
this <
time );
191 return !( *
this ==
time );
201 if ( mSec != time.
GetSec() ) {
202 return ( mSec < time.
GetSec() );
204 return ( mNSec < time.
GetNSec() );
215 if (mSec != time.
GetSec()) {
216 return ( mSec > time.
GetSec() );
218 return ( mNSec > time.
GetNSec() );
296 unsigned long long tmp = dt*1000000000;
297 mNSec = (tmp%1000000000);
305 dt = mSec + 1.e-9 * mNSec;
317 if (date.CompareTo(
"now")==0) {
318 time_t ticks =
time(NULL);
319 this->SetSec(mktime(gmtime(&ticks)));
328 if (date.IsDigit()) {this->SetSec(date.Atoi());
return;}
331 if (date.Sizeof()==20) {
334 if (yy>=80)
if(xx!=19) {
336 sprintf(msg,
"error in data format : %s [Year >= 1980 && <2079]",date.Data());
339 if (yy<80)
if(xx!=20) {
341 sprintf(msg,
"error in data format : %s [Year >= 1980 && <2079]",date.Data());
344 idate = date(17,2)+
":"+date(14,2)+
":"+date(11,2)+
"-"+date(8,2)+
":"+date(5,2)+
":"+date(2,2);
357 char DD_s[4],MM_s[4],YY_s[4],hh_s[4],mm_s[4],ss_s[4];
358 int DD,MM,YY,hh,mm,
ss;
362 strncpy(ss_s,date,2);
368 strncpy(mm_s,date+3,2);
374 strncpy(hh_s,date+6,2);
380 strncpy(DD_s,date+9,2);
386 strncpy(MM_s,date+12,2);
392 strncpy(YY_s,date+15,2);
399 SetDate(ss,mm,hh,DD,MM,YY,nsec);
406 if(YY>1900) YY-=1900;
420 setenv(
"TZ",
":UTC", 1);
422 time_t in_utc_sec = mktime(&in_tp);
423 struct tm* out_tp = gmtime(&in_utc_sec);
424 time_t out_utc_sec = mktime(out_tp);
445 Time tempTime(*
this);
460 TObjString* week_tok = (TObjString*)token->At(0);
461 TString week = week_tok->GetString();
462 TObjString* month_tok = (TObjString*)token->At(1);
463 TString month = month_tok->GetString();
464 TObjString* day_tok = (TObjString*)token->At(2);
465 TString day = day_tok->GetString();
466 TObjString* hhmmss_tok = (TObjString*)token->At(3);
467 TString hhmmss = hhmmss_tok->GetString();
468 if(leap) {hhmmss[6]=
'6';hhmmss[7]=
'0';}
469 TObjString* year_tok = (TObjString*)token->At(4);
470 TString year = year_tok->GetString();
471 year.Resize(year.Sizeof()-2);
473 if(month.CompareTo(
"Jan")==0) month=
"01";
474 if(month.CompareTo(
"Feb")==0) month=
"02";
475 if(month.CompareTo(
"Mar")==0) month=
"03";
476 if(month.CompareTo(
"Apr")==0) month=
"04";
477 if(month.CompareTo(
"May")==0) month=
"05";
478 if(month.CompareTo(
"Jun")==0) month=
"06";
479 if(month.CompareTo(
"Jul")==0) month=
"07";
480 if(month.CompareTo(
"Aug")==0) month=
"08";
481 if(month.CompareTo(
"Sep")==0) month=
"09";
482 if(month.CompareTo(
"Oct")==0) month=
"10";
483 if(month.CompareTo(
"Nov")==0) month=
"11";
484 if(month.CompareTo(
"Dec")==0) month=
"12";
488 sprintf(date,
"%s-%s-%02d %s UTC %s",year.Data(),month.Data(),day.Atoi(),hhmmss.Data(),week.Data());
502 cout << GetDateString().Data() << endl;
555 const int sec_per_day = 60 * 60 * 24;
556 int year, month, day, sec;
565 sec = GetSecond() + 60*(GetMinute() + 60*GetHour());
567 jd = 367*year - 7*(year + (month + 9)/12)/4 + 275*month/9 + day + 1721014;
569 jd += (double)sec/(
double)sec_per_day - 0.5;
586 double jd = GetJulianDate();
616 out << time.
GetSec() <<
":";
wavearray< double > t(hp.size())
int GpsToGpsLeaps(int gpsSec)
Time & operator=(Time &time)
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
void SetDate(int ss, int mm, int hh, int DD, int MM, int YY, int nsec=0)
bool operator!=(Time &time)
void SetDateString(TString date)
Time operator-(Time &t1, Time &t2)
void SetString(char *date, int nsec=0)
Time operator+(Time &t1, Time &t2)
Time operator*(Time &t, double &d)
cout<< "Selected Pixels : "<< nPix<< endl;wc.cluster(1, 1);SSeries< double > ss
istream & operator>>(istream &in, Time &time)
double operator/(Time &time)
#define GPS_LEAPS_TABLE_SIZE
ostream & operator<<(ostream &out, Time &time)
void SetDouble(double dt)
bool operator==(Time &time)
static const gps_leap gps_leaps_table[GPS_LEAPS_TABLE_SIZE]
bool operator<=(Time &time)
Time operator/(Time &t, double &d)
Time & operator*=(double &d)
Time(INT_4S sec=0, INT_4U nsec=0)
double GetModJulianDate()
Time & operator-=(Time &time)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
Time & operator+=(Time &time)
bool operator<(Time &time)
Time & operator/=(double &d)
bool operator>=(Time &time)
bool operator>(Time &time)