Changeset 2566 in ntrip for trunk/BNC/bnctime.cpp


Ignore:
Timestamp:
Aug 11, 2010, 3:11:24 PM (14 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnctime.cpp

    r2257 r2566  
    113113    return this->_sec - time1._sec;
    114114  }
     115}
     116
     117//
     118//////////////////////////////////////////////////////////////////////////////
     119void bncTime::civil_date (unsigned int& year, unsigned int& month,
     120                          unsigned int& day) const {
     121  double day_d;
     122  long int yy, mm;
     123  jmt(_mjd, yy, mm, day_d);
     124  year  = yy;
     125  month = mm;
     126  day   = static_cast<unsigned int>(day_d);
    115127}
    116128
     
    166178}
    167179
     180//
     181//////////////////////////////////////////////////////////////////////////////
     182string bncTime::datestr(char sep) const {
     183  unsigned int year, month, day;
     184  civil_date(year,month,day);
     185  ostringstream str;
     186  str.setf(ios::fixed);
     187  str << setfill('0');
     188  str << setw(4)  << year;
     189  if (sep) str << sep;
     190  str << setw(2)  << month;
     191  if (sep) str << sep;
     192  str << setw(2)  << day;
     193  return str.str();
     194}
    168195
    169196//
Note: See TracChangeset for help on using the changeset viewer.