Index: trunk/BNC/bnc.pro
===================================================================
--- trunk/BNC/bnc.pro	(revision 2121)
+++ trunk/BNC/bnc.pro	(revision 2122)
@@ -36,5 +36,5 @@
           bncnetqueryrtp.h bncsettings.h latencychecker.h             \
           bncipport.h bncnetqueryv0.h bncnetqueryudp.h                \ 
-          bncnetqueryudp0.h bncudpport.h t_time.h                     \ 
+          bncnetqueryudp0.h bncudpport.h bnctime.h                    \ 
           bncserialport.h bncnetquerys.h bncfigure.h                  \ 
           bncfigurelate.h bncpppclient.h bncversion.h                 \ 
@@ -66,5 +66,5 @@
           bncnetqueryudp0.cpp bncudpport.cpp                          \
           bncserialport.cpp bncnetquerys.cpp bncfigure.cpp            \
-          bncfigurelate.cpp bncpppclient.cpp t_time.cpp               \
+          bncfigurelate.cpp bncpppclient.cpp bnctime.cpp              \
           bancroft.cpp bncmodel.cpp                                   \ 
           RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp                        \
Index: trunk/BNC/t_time.cpp
===================================================================
--- trunk/BNC/t_time.cpp	(revision 2121)
+++ trunk/BNC/t_time.cpp	(revision 2122)
@@ -9,87 +9,12 @@
 using namespace std;
 
-double t_time::djul(long jj, long mm, double tt) {
-  long    ii, kk;
-  double  djul ;
-  if( mm <= 2 ) {
-    jj = jj - 1;
-    mm = mm + 12;
-  }  
-  ii   = jj/100;
-  kk   = 2 - ii + ii/4;
-  djul = (365.25*jj - fmod( 365.25*jj, 1.0 )) - 679006.0;
-  djul = djul + floor( 30.6001*(mm + 1) ) + tt + kk;
-  return djul;
-} 
-
-double t_time::gpjd(double second, int nweek) {
-  double deltat;
-  deltat = nweek*7.0 + second/86400.0 ;
-  return( 44244.0 + deltat) ;
-} 
-
-void t_time::jdgp(double tjul, double & second, long & nweek) {
-  double      deltat;
-  deltat = tjul - 44244.0 ;
-  nweek = (long) floor(deltat/7.0);
-  second = (deltat - (nweek)*7.0)*86400.0;
-}
-
-void t_time::jmt(double djul, long& jj, long& mm, double& dd) {
-  long   ih, ih1, ih2 ;
-  double t1, t2,  t3, t4;
-  t1  = 1.0 + djul - fmod( djul, 1.0 ) + 2400000.0;
-  t4  = fmod( djul, 1.0 );
-  ih  = long( (t1 - 1867216.25)/36524.25 );
-  t2  = t1 + 1 + ih - ih/4;
-  t3  = t2 - 1720995.0;
-  ih1 = long( (t3 - 122.1)/365.25 );
-  t1  = 365.25*ih1 - fmod( 365.25*ih1, 1.0 );
-  ih2 = long( (t3 - t1)/30.6001 );
-  dd  = t3 - t1 - (int)( 30.6001*ih2 ) + t4;
-  mm  = ih2 - 1;
-  if ( ih2 > 13 ) mm = ih2 - 13;
-  jj  = ih1;
-  if ( mm <= 2 ) jj = jj + 1;
-} 
-
-t_time::t_time(int gpsw, int dow, double daysec) {
-  this->set(gpsw, dow, daysec);
-}
-
+// Constructor
+//////////////////////////////////////////////////////////////////////////////
 t_time::t_time(int gpsw, double gpssec) {
   this->set(gpsw, gpssec);
 }
   
-t_time::t_time(int hour, int min, double sec, 
-                     int day,  int month, int year) {
-  double  daysec = hour*3600.0 + min*60.0 + sec;
-  this->set(daysec, day, month, year);
-}
-
-t_time::t_time(double daysec, int day, int month, int year) {
-  this->set(daysec, day, month, year);
-}
-
-t_time::t_time(double daysec, int doy, unsigned int year) {
-  this->set(daysec, doy, year);
-}
-
-t_time& t_time::set(int gpsw, int dow, double daysec) {
-  int deltad;
-  while (daysec >= 86400) {
-    daysec-=86400;
-    dow++;
-  }
-  while (daysec < 0) {
-    daysec+=86400;
-    dow--;
-  }
-  deltad = gpsw*7 + dow;
-  _mjd = 44244 + deltad;
-  _sec = daysec;
-  return *this;
-}
-
+// 
+//////////////////////////////////////////////////////////////////////////////
 t_time& t_time::set(int gpsw, double gpssec) {
   int  deltad;
@@ -109,36 +34,6 @@
 }
 
-t_time& t_time::set(int hour, int min, double sec, int day,  int month, int year) {
-  return this->set(hour*3600 + min*60 + sec, day, month, year);
-}
-
-t_time& t_time::set(double daysec, int day, int month, int year) {
-  _sec = daysec;
-  _mjd = (unsigned int)djul(year, month, day);
-  while ( _sec >= 86400 ) {
-    _sec-=86400;
-    _mjd++;
-  }
-  while ( _sec <  0 ) {
-    _sec+=86400;
-    _mjd--;
-  }
-  return *this;
-}
-
-t_time& t_time::set(double daysec, int doy, int year) {
-  _mjd = (unsigned int)djul(year, 1, 1) + (doy - 1);
-  _sec = daysec;
-  while ( _sec >= 86400 ) {
-    _sec-=86400;
-    _mjd++;
-  }
-  while ( _sec <  0 ) {
-    _sec+=86400;
-    _mjd--;
-  }
-  return *this;
-}
-
+// 
+//////////////////////////////////////////////////////////////////////////////
 t_time& t_time::setmjd(double daysec, int mjd) {
   _sec = daysec;
@@ -154,31 +49,53 @@
   return *this;
 }
-  
-t_time& t_time::setmjd(double mjddec) {
-  _mjd = static_cast<unsigned int>(mjddec);
-  _sec = (mjddec - _mjd)*86400.0;
-  return *this;
+
+// 
+//////////////////////////////////////////////////////////////////////////////
+void t_time::jdgp(double tjul, double & second, long & nweek) {
+  double      deltat;
+  deltat = tjul - 44244.0 ;
+  nweek = (long) floor(deltat/7.0);
+  second = (deltat - (nweek)*7.0)*86400.0;
 }
 
-t_time& t_time::operator++() { //prefix
-  return (*this) += 1.0;
+// 
+//////////////////////////////////////////////////////////////////////////////
+unsigned int t_time::mjd() const {
+  return _mjd;
+}
+ 
+//
+//////////////////////////////////////////////////////////////////////////////
+double t_time::daysec() const {
+  return _sec;
 }
 
-t_time t_time::operator++(int) { //postfix
-  t_time tmp = (*this);
-  (*this) += 1.0;
-  return tmp;
+//
+//////////////////////////////////////////////////////////////////////////////
+unsigned int t_time::gpsw() const {
+  double   gsec;
+  long     gpsw;
+  jdgp(_mjd, gsec, gpsw);
+  return (int)gpsw;
 }
 
-t_time& t_time::operator--() { //prefix
-  return (*this) -= 1.0;
+// 
+//////////////////////////////////////////////////////////////////////////////
+double t_time::gpssec() const {
+  double   gsec;
+  long     gpsw;
+  jdgp(_mjd, gsec, gpsw);
+  return gsec + _sec;
 }
 
-t_time t_time::operator--(int) { //postfix
-  t_time tmp = *this;
-  (*this) -= 1.0;
-  return tmp;
+// 
+//////////////////////////////////////////////////////////////////////////////
+bool t_time::operator!=(const t_time &time1) const {
+  if ( ((*this) - time1) != 0 ) return 1;
+  return 0;
 }
 
+// 
+//////////////////////////////////////////////////////////////////////////////
 t_time t_time::operator+(double sec) const {
   int     mjd    = this->mjd();
@@ -188,25 +105,12 @@
 }
 
+// 
+//////////////////////////////////////////////////////////////////////////////
 t_time t_time::operator-(double sec) const {
   return (*this) + (-sec);
 }
 
-t_time& t_time::operator+=(double sec) {
-  _sec+=sec;
-  while ( _sec >= 86400 ) {
-    _sec-=86400;
-    _mjd++;
-  }
-  while ( _sec < 0 ) {
-    _sec+=86400;
-    _mjd--;
-  }
-  return *this;
-}
-
-t_time& t_time::operator-=(double sec) {
-  return (*this)+=(-sec);
-}
-
+// 
+//////////////////////////////////////////////////////////////////////////////
 double t_time::operator-(const t_time &time1) const {
   int mjdDiff = this->_mjd - time1._mjd;
@@ -219,54 +123,6 @@
 }
 
-bool t_time::operator<(const t_time &time1) const {
-  if ( ((*this) - time1) < 0 ) return 1;
-  return 0;
-}
-
-bool t_time::operator<=(const t_time &time1) const {
-  if ( ((*this) - time1) <= 0 ) return 1;
-  return 0;
-}
-
-bool t_time::operator>(const t_time &time1) const {
-  if ( ((*this) - time1) > 0 ) return 1;
-  return 0;
-}
-
-bool t_time::operator>=(const t_time &time1) const {
-  if ( ((*this) - time1) >= 0 ) return 1;
-  return 0;
-}
-
-bool t_time::operator==(const t_time &time1) const {
-  if ( ((*this) - time1) == 0 ) return 1;
-  return 0;
-}
-
-bool t_time::operator!=(const t_time &time1) const {
-  if ( ((*this) - time1) != 0 ) return 1;
-  return 0;
-}
-
-void t_time::civil_datum(unsigned int &year, 
-                            unsigned int &month, unsigned int &day) const {
-  double day_d;
-  long int yy, mm;
-  jmt(_mjd, yy, mm, day_d);
-  year  = yy;
-  month = mm;
-  day   = static_cast<unsigned int>(day_d);
-}
-
-void t_time::civil_datum(int &year, int &month, int &day) const {
-  unsigned int yy = year;
-  unsigned int mm = month;
-  unsigned int dd = day;
-
-  civil_datum(yy, mm, dd);
-
-  year = yy; month = mm; day = dd;
-}
-
+// 
+//////////////////////////////////////////////////////////////////////////////
 void t_time::civil_time(unsigned int &hour, unsigned int &min, 
                           double &sec) const {
@@ -284,94 +140,6 @@
 }
 
-void t_time::civil_time(int &hour, int &min, double &sec) const {
-  unsigned int hh, mm;
-  hh = hour;
-  mm = min;
-
-  civil_time(hh, mm, sec);
-
-  hour = hh; min = mm;
-}
-
-unsigned int t_time::year() const {
-  unsigned int year, month, day;
-  this->civil_datum(year, month, day);
-  return year;
-}
-
-unsigned int t_time::month() const {
-  unsigned int year, month, day;
-  this->civil_datum(year, month, day);
-  return month;
-}
-
-unsigned int t_time::day() const {
-  unsigned int year, month, day;
-  this->civil_datum(year, month, day);
-  return (unsigned int)day;
-}
-
-unsigned int t_time::hour() const {
-  unsigned int hour, minute;
-  double sec;
-  this->civil_time(hour, minute, sec);
-  return hour;
-}
-
-unsigned int t_time::minute() const {
-  unsigned int hour, minute;
-  double sec;
-  this->civil_time(hour, minute, sec);
-  return minute;
-}
-
-double t_time::sec() const {
-  unsigned int hour, minute;
-  double sec;
-  this->civil_time(hour, minute, sec);
-  return sec;
-}
-
-unsigned int t_time::doy() const {
-  return  _mjd - (int)djul(this->year(), 1, 1) + 1;
-}
-
-unsigned int t_time::mjd() const {
-  return _mjd;
-}
-
-double t_time::mjddec() const {
-  return _mjd + _sec / 86400.0;
-}
-  
-double t_time::daysec() const {
-  return _sec;
-}
-
-unsigned int t_time::gpsw() const {
-  double   gsec;
-  long     gpsw;
-  jdgp(_mjd, gsec, gpsw);
-  return (int)gpsw;
-}
-
-unsigned int t_time::dow() const {
-  double   gsec;
-  long     gpsw;
-  jdgp(_mjd+_sec/86400.0, gsec, gpsw);
-  return (unsigned int)(gsec/86400.0);
-}
-
-double t_time::gpssec() const {
-  double   gsec;
-  long     gpsw;
-  jdgp(_mjd, gsec, gpsw);
-  return gsec + _sec;
-}
-
-t_time::operator string() const {
-  return datestr() + ' ' + timestr();
-}
-
+// 
+//////////////////////////////////////////////////////////////////////////////
 string t_time::timestr(unsigned numdec, char sep) const {
   ostringstream str;
@@ -406,18 +174,2 @@
 }
 
-string t_time::datestr(bool digit2year, char sep) const {
-  ostringstream str;
-  str.setf(ios::fixed);
-  str << setfill('0');
-  if (digit2year) {
-    str << setw(2) << (year() % 100);
-  }
-  else {
-    str << setw(4) << year();
-  }
-  if (sep) str << sep;
-  str << setw(2) << month();
-  if (sep) str << sep;
-  str << setw(2) << day();
-  return str.str();
-}
Index: trunk/BNC/t_time.h
===================================================================
--- trunk/BNC/t_time.h	(revision 2121)
+++ trunk/BNC/t_time.h	(revision 2122)
@@ -7,79 +7,27 @@
 class t_time {
  public:
-  static double djul(long j1, long m1, double tt);
-  static double gpjd(double second, int nweek) ;
-  static void   jdgp(double tjul, double & second, long & nweek);
-  static void   jmt (double djul, long& jj, long& mm, double& dd);
+  t_time() {this->reset();}
+  t_time(int gpsw, double gpssec);
 
-  t_time() {this->reset();}
-  t_time(int gpsw, int dow, double daysec);
-  t_time(int gpsw, double gpssec);
-  t_time(int hour, int min, double sec, int day,  int month, int year);
-  t_time(double daysec, int day, int month, int year);
-  t_time(double daysec, int doy, unsigned int year);
+  t_time& set(int gpsw, double gpssec);
 
-  void reset() {_mjd = 0; _sec = 0;}
-  bool undef() const {return (_mjd==0 && _sec==0);}
-  bool valid() const {return (_mjd!=0 || _sec!=0);}
+  unsigned int mjd()    const;
+  double       daysec() const;
+  unsigned int gpsw()   const;
+  double       gpssec() const;
 
-  t_time &  operator++();
-  t_time    operator++(int);
+  bool   operator!=(const t_time &time1) const;
+  double operator-(const t_time &time1) const;
+  t_time operator-(double sec) const;
+  t_time operator+(double sec) const;
 
-  t_time &  operator--();
-  t_time    operator--(int);
-
-  t_time    operator+(double sec) const;
-  t_time    operator-(double sec) const;
-
-  t_time&   operator+=(double sec);
-  t_time&   operator-=(double sec);
-
-  double operator-(const t_time &time1) const;
-
-  bool operator< (const t_time &time1) const;
-  bool operator<=(const t_time &time1) const;
-  bool operator> (const t_time &time1) const;
-  bool operator>=(const t_time &time1) const;
-  bool operator==(const t_time &time1) const;
-  bool operator!=(const t_time &time1) const;
-
-  unsigned int  gpsw()   const;
-  unsigned int  dow()    const;
-  double        daysec() const;
-  double        gpssec() const;
-
-  unsigned int  doy()    const;
-  unsigned int  mjd()    const;
-  double        mjddec() const;
-
-  unsigned int  year()   const;
-  unsigned int  month()  const;
-  unsigned int  day()    const;
-  unsigned int  hour()   const;
-  unsigned int  minute() const;
-  double        sec()    const;
-
-  void civil_datum(unsigned int& year, 
-		   unsigned int& month, unsigned int& day) const;
-  void civil_time (unsigned int& hour, unsigned int& min,   double& sec) const;
-  void civil_datum(int& year, 
-		   int& month, int& day) const;
-  void civil_time (int& hour, int& min, double& sec) const;
-  
-  t_time& set(int gpsw, int dow, double daysec);
-  t_time& set(int gpsw, double gpssec);
-  t_time& set(int hour, int min, double sec, int day,  int month, int year);
-  t_time& set(double daysec, int day, int month, int year);
-  t_time& set(double daysec, int doy, int year);
-  t_time& setmjd(double daysec, int mjd);
-  t_time& setmjd(double mjddec);
-
-  t_time& setmachinetime(bool gmt = false);
-
-  operator std::string() const;
-  std::string datestr(bool digit2year = false, char sep = '-') const;  
   std::string timestr(unsigned numdec = 3, char sep = ':') const;  
 
  private:
+  t_time&     setmjd(double daysec, int mjd);
+  void        reset() {_mjd = 0; _sec = 0;}
+  void        civil_time (unsigned int& hour, unsigned int& min,   double& sec) const;
+  static void jdgp(double tjul, double & second, long & nweek);
+
   unsigned int _mjd;
   double       _sec;
