void InputRemapperSystem::touchDown(float x, float y)
{
    TimeSystem* pTime = getSystem<TimeSystem>();
    const float time = pTime->getGameTime();

    Vector2 motion(x, y);
    int xAxis = GameButtons::BUTTON_leftAxisX;
    int yAxis = GameButtons::BUTTON_leftAxisY;
    if (x <= getScreenWidth() / 2)
    {
        motion -= getLeftThumbStickCenter();
    }
    else
    {
        motion -= getRightThumbStickCenter();
        xAxis = GameButtons::BUTTON_rightAxisX;
        yAxis = GameButtons::BUTTON_rightAxisY;
    }

    motion[0] = Clamp(motion[0], -getThumbStickRadius(), getThumbStickRadius());
    motion[1] = Clamp(motion[1], -getThumbStickRadius(), getThumbStickRadius());


    motion /= getThumbStickRadius();

    mButtons[xAxis]->updateDeflection(motion[0], time);
    mButtons[yAxis]->updateDeflection(motion[1], time);
}
Пример #2
0
void LifetimeComponent::update(const float timeDelta, GameObject* pParentObject)
{
	bool timeToDie = false;
	
	if (pParentObject->getRuntimeData()->exists("deathTime"))
	{
		TimeSystem* time = getSystem<TimeSystem>();
		float currentTime = time->getGameTime();
		if (currentTime  > pParentObject->getRuntimeData()->getFloat("deathTime"))
		{
			timeToDie = true;
		}
	}
	
	if (timeToDie)
	{
		pParentObject->getRuntimeData()->insertInt(0, "visible");
		
		GameObjectPoolSystem* poolSystem = getSystem<GameObjectPoolSystem>();
		if (poolSystem && poolSystem->isPooledObject(pParentObject))
		{
			poolSystem->release(pParentObject);
		}
		
		GameObjectSystem* objectManager = getSystem<GameObjectSystem>();
		if (objectManager)
		{
			objectManager->remove(pParentObject);
		}
	}

}
void InputRemapperSystem::rollDown(float x, float y)
{
    TimeSystem* pTime = getSystem<TimeSystem>();
    const float time = pTime->getGameTime();
    mButtons[GameButtons::BUTTON_rightAxisX]->updateDeflection(x, time);
    mButtons[GameButtons::BUTTON_rightAxisY]->updateDeflection(y, time);
    mLastRollTime = time;
}
void InputRemapperSystem::update(const float timeDelta, const UpdatePhase phase)
{
    TimeSystem* pTime = getSystem<TimeSystem>();
    const float time = pTime->getGameTime();

    if (mLastRollTime > 0.0f && time - mLastRollTime > timeDelta)
    {
        mButtons[GameButtons::BUTTON_rightAxisX]->release(time);
        mButtons[GameButtons::BUTTON_rightAxisY]->release(time);
    }
}
void InputRemapperSystem::touchUp(float x, float y)
{
    TimeSystem* pTime = getSystem<TimeSystem>();
    const float time = pTime->getGameTime();

    if (x <= getScreenWidth() / 2)
    {
        mButtons[GameButtons::BUTTON_leftAxisX]->release(time);
        mButtons[GameButtons::BUTTON_leftAxisY]->release(time);
    }
    else
    {
        mButtons[GameButtons::BUTTON_rightAxisX]->release(time);
        mButtons[GameButtons::BUTTON_rightAxisY]->release(time);
    }

}
Пример #6
0
void Game::Run()
{
    TimeSystem* timeSystem = TimeSystem::GetInstance();

    timeSystem->StartClock();

    while (true)
    {
        // Tick time
        timeSystem->Tick();

        // Loop as many update-steps we will take this frame
        while (timeSystem->ShouldUpdateFrame())
        {
            // Update game based on state
            Update(timeSystem->GetStepLength());

            // Update accumulator and gametime
            timeSystem->UpdateAccumulatorAndGameTime();
        }

        // Update alpha used for inteprolation
        double alpha = timeSystem->GetFrameAlpha();

        // Update camera after we update positions
        Render();
    }
}
Пример #7
0
   // Find the appropriate time system correction object in the collection for the
   // given time systems, and dump it to a string and return that string.
   string Rinex3EphemerisStore::dumpTimeSystemCorrection(
      const TimeSystem fromSys, const TimeSystem toSys) const
   {
      string msg;
      ostringstream oss;
      oss << "Convert from " << fromSys.asString()
         << " to " << toSys.asString() << " : ";

      if(toSys == fromSys) {
         oss << "time systems are the same";
         return oss.str();
      }

      // look up the TimeSystemCorr in list, and dump it
      map<string, TimeSystemCorrection>::const_iterator it;
      for(it = mapTimeCorr.begin(); it != mapTimeCorr.end(); ++it) {
         if(it->second.isConverterFor(fromSys, toSys)) {
            it->second.dump(oss);
            return oss.str();
         }
      }
      oss << "conversion not found!";
      return oss.str();
   }
Пример #8
0
   // Utility routine for getXvt and addEphemeris to convert time systems.
   // Convert ttag to the target time system, using the first appropriate correction
   // in the list, and return it. If no correction is found, ttag is unchanged and
   // an exception is thrown.
   CommonTime Rinex3EphemerisStore::correctTimeSystem(const CommonTime ttag,
                                                      const TimeSystem targetSys)
      const
   {
      CommonTime toReturn(ttag);
      TimeSystem fromSys(ttag.getTimeSystem());

      // is a conversion necessary?
      if(fromSys == targetSys)
         return toReturn;

      // first correct for leap seconds
      const CivilTime civt(ttag);
      double dt = TimeSystem::Correction(fromSys, targetSys,
                              civt.year, civt.month, civt.day);
      toReturn += dt;
      toReturn.setTimeSystem(targetSys);
      // the corrected timetag: now only the system, not the value, matters
      toReturn.setTimeSystem(targetSys);

      // look up the TimeSystemCorr in list, and do the conversion
      map<string, TimeSystemCorrection>::const_iterator it;
      for(it = mapTimeCorr.begin(); it != mapTimeCorr.end(); ++it) {
         if(it->second.isConverterFor(fromSys, targetSys)) {
            dt = it->second.Correction(ttag);
            toReturn += dt;
            return toReturn;
         }
      }

      // failure
      InvalidRequest e("Unable to convert time systems from "
         + ttag.getTimeSystem().asString() + " to " + targetSys.asString());
      GPSTK_THROW(e);

      return toReturn;      // never reached, satisfy some compilers
   }
Пример #9
0
   void mixedScanTime( CommonTime& t,
                       const string& str,
                       const string& fmt )
   {
      try
      {
         using namespace gpstk::StringUtils;

            // Get the mapping of character (from fmt) to value (from str).
         TimeTag::IdToValue info;
         TimeTag::getInfo( str, fmt, info );
         
            // These indicate which information has been found.
         bool hsow( false ), hweek( false ), hfullweek( false ),
            hdow( false ), hyear( false ), hmonth( false ), hday( false ),
            hzcount( false ), hdoy( false ), hzcount29( false ), 
            hhour( false ), hmin( false ), hsec( false ),
            hsod( false ), hepoch( false ), hunixsec( false ),
            hunixusec( false ),
            hbdsw( false ), hqzsw( false ), hgalw( false ),
            hbdsfw( false ), hqzsfw( false ), hgalfw( false ),
            hbdse( false ), hqzse( false ), hgale( false);
#pragma unused(hunixsec,hunixusec)
            // MJD, Julian Date, ANSI time, Unix time, and 32-bit Zcounts
            // are treated as stand-alone types and are not mixed with others
            // if detected.
         
            // These variables will hold the values for use later.
         double isow, isod, isec;
         int iweek, ifullweek, idow, iyear, imonth, iday, izcount, idoy,
            izcount29, ihour, imin, iepoch;
         TimeSystem ts;

         for( TimeTag::IdToValue::iterator itr = info.begin();
              itr != info.end(); itr++ )
         {
            switch( itr->first )
            {
               case 'P':
                  ts.fromString(itr->second);
                  t.setTimeSystem(ts);
                  break;

               case 'Q':
                  t = MJD( asLongDouble(itr->second) );
                  return;

               case 'J':
                  t = JulianDate( asLongDouble(itr->second) );
                  return;
                  
               case 'C':
                  t = GPSWeekZcount().setZcount32( asInt(itr->second) );
                  return;

               case 'K':
                  t = ANSITime( asInt(itr->second) );
                  return;
                  
               case 'U':
               case 'u':
               {
                  UnixTime tt;
                  tt.setFromInfo( info );
                  t = tt.convertToCommonTime();
                  return;
               }
               break;

               case 'Z':
                  hzcount = true;
                  izcount = asInt(itr->second);
                  break;

               case 's':
                  hsod = true;
                  isod = asDouble(itr->second);
                  break;

               case 'g':
                  hsow = true;
                  isow = asDouble(itr->second);
                  break;

               case 'w':
                  idow = asInt(itr->second);
                  hdow = true;
                  break;

               case 'G':
                  hweek = true;
                  iweek = asInt(itr->second);
                  break;

               case 'F':
                  hfullweek = true;
                  ifullweek = asInt(itr->second);
                  break;

               case 'j':
                  hdoy = true;
                  idoy = asInt(itr->second);
                  break;

               case 'b':
               case 'B':
                  hmonth = true;
                  imonth = asInt(itr->second);
                  break;

               case 'Y':
               case 'y':
                  hyear = true;
                  iyear = asInt(itr->second);
                  break;

               case 'a':
               case 'A':
               {
                  hdow = true;
                  string thisDay = firstWord( itr->second );
                  lowerCase(thisDay);
                  if (isLike(thisDay, "sun.*")) idow = 0;
                  else if (isLike(thisDay, "mon.*")) idow = 1;
                  else if (isLike(thisDay, "tue.*")) idow = 2;
                  else if (isLike(thisDay, "wed.*")) idow = 3;
                  else if (isLike(thisDay, "thu.*")) idow = 4;
                  else if (isLike(thisDay, "fri.*")) idow = 5;
                  else if (isLike(thisDay, "sat.*")) idow = 6;
               }
               break;
                  
               case 'm':
                  hmonth = true;
                  imonth = asInt(itr->second);
                  break;

               case 'd':
                  hday = true;
                  iday = asInt(itr->second);
                  break;

               case 'H':
                  hhour = true;
                  ihour = asInt(itr->second);
                  break;

               case 'M':
                  hmin = true;
                  imin = asInt(itr->second);
                  break;

               case 'S':
                  hsec = true;
                  isec = asDouble(itr->second);
                  break;

               case 'f':
                  hsec = true;
                  isec = asDouble(itr->second);
                  break;

               case 'c':
                  hzcount29 = true;
                  izcount29 = asInt(itr->second);
                  break;

               case 'E':
                  hepoch = true;
                  iepoch = asInt(itr->second);
                  break;

               case 'R': hepoch = hbdse = true; iepoch = asInt(itr->second); break;
               case 'T': hepoch = hgale = true; iepoch = asInt(itr->second); break;
               case 'V': hepoch = hqzse = true; iepoch = asInt(itr->second); break;

               case 'D': hfullweek = hbdsfw = true; break;
               case 'e': hweek = hbdsw = true; break;
               case 'L': hfullweek = hgalfw = true; break;
               case 'l': hweek = hgalw = true; break;
               case 'I': hfullweek = hqzsfw = true; break;
               case 'i': hweek = hqzsw = true; break;

               default:
                     // do nothing
                  break;

            };
         }

         bool hbds(hbdse || hbdsfw || hbdsw);
         bool hgal(hgale || hgalfw || hgalw);
         bool hqzs(hqzse || hqzsfw || hqzsw);

            // We'll copy this time to 't' after all of the processing.
         CommonTime ct;
         ct.setTimeSystem(t.getTimeSystem());
         
            // Go through all of the types in order of least precise to most
            // precise.
         if( hepoch ) 
         {
            WeekSecond *ptt;
            if(hbds) ptt = new BDSWeekSecond(ct);
            else if(hqzs) ptt = new QZSWeekSecond(ct);
            else if(hgal) ptt = new GALWeekSecond(ct);
            else ptt = new GPSWeekSecond(ct);
            ptt->setEpoch( iepoch );
            ct = ptt->convertToCommonTime();
         }
         
         if( hyear )
         {
            YDSTime tt(ct);
            tt.year = iyear;
            ct = tt.convertToCommonTime();
         }
 
         if( hmonth )
         {
            CivilTime tt(ct);
            tt.month = imonth;
            ct = tt.convertToCommonTime();
         }

         if( hfullweek )
         {
            WeekSecond *ptt;
            if(hbds) ptt = new BDSWeekSecond(ct);
            else if(hqzs) ptt = new QZSWeekSecond(ct);
            else if(hgal) ptt = new GALWeekSecond(ct);
            else ptt = new GPSWeekSecond(ct);
            ptt->week = ifullweek;
            ct = ptt->convertToCommonTime();
         }
         
         if( hweek )
         {
            WeekSecond *ptt;
            if(hbds) ptt = new BDSWeekSecond(ct);
            else if(hqzs) ptt = new QZSWeekSecond(ct);
            else if(hgal) ptt = new GALWeekSecond(ct);
            else ptt = new GPSWeekSecond(ct);
            ptt->setModWeek(iweek);
            ct = ptt->convertToCommonTime();
         }
         
         if( hdow )
         {
            WeekSecond *ptt;
            if(hbds) ptt = new BDSWeekSecond(ct);
            else if(hqzs) ptt = new QZSWeekSecond(ct);
            else if(hgal) ptt = new GALWeekSecond(ct);
            else ptt = new GPSWeekSecond(ct);
            ptt->sow = static_cast<double>(idow) * SEC_PER_DAY;
            ct = ptt->convertToCommonTime();
         }
         
         if( hday )
         {
            CivilTime tt(ct);
            tt.day = iday;
            ct = tt.convertToCommonTime();
         }
         
         if( hdoy )
         {
            YDSTime tt(ct);
            tt.doy = idoy;
            ct = tt.convertToCommonTime();
         }
         
         if( hzcount29 )
         {
            GPSWeekZcount tt(ct);
            tt.setZcount29( izcount29 );
            ct = tt.convertToCommonTime(); 
         }

         if( hzcount )
         {
            GPSWeekZcount tt(ct);
            tt.zcount = izcount;
            ct = tt.convertToCommonTime();
         }

         if( hhour )
         {
            CivilTime tt(ct);
            tt.hour = ihour;
            ct = tt.convertToCommonTime();
         }

         if( hmin )
         {
            CivilTime tt(ct);
            tt.minute = imin;
            ct = tt.convertToCommonTime();
         }
         
         if( hsow )
         {
            WeekSecond *ptt;
            if(hbds) ptt = new BDSWeekSecond(ct);
            else if(hqzs) ptt = new QZSWeekSecond(ct);
            else if(hgal) ptt = new GALWeekSecond(ct);
            else ptt = new GPSWeekSecond(ct);
            ptt->sow = isow;
            ct = ptt->convertToCommonTime();
         }
         
         if( hsod )
         {
            YDSTime tt(ct);
            tt.sod = isod;
            ct = tt.convertToCommonTime();
         }

         if( hsec )
         {
            CivilTime tt(ct);
            tt.second = isec;
            ct = tt.convertToCommonTime();
         }
         
         t = ct;
      }
      catch( gpstk::StringUtils::StringException& se )
      {
         GPSTK_RETHROW( se );
      }
   }   
Пример #10
0
   void scanTime( CommonTime& t,
                  const string& str,
                  const string& fmt )
   {
      try
      {
         using namespace gpstk::StringUtils;

            // Get the mapping of character (from fmt) to value (from str).
         TimeTag::IdToValue info;
         TimeTag::getInfo( str, fmt, info );
         
            // These indicate which information has been found.
         bool hmjd( false ), hsow( false ), hweek( false ), hfullweek( false ),
            hdow( false ), hyear( false ), hmonth( false ), hday( false ),
            hzcount( false ), hdoy( false ), hzcount29( false ), 
            hzcount32( false ), hhour( false ), hmin( false ), hsec( false ),
            hsod( false ), hunixsec( false ), hunixusec( false ), 
            hepoch( false ), hansi( false ), hjulian( false ),
            hbdsw( false ), hqzsw( false ), hgalw( false ),
            hbdsfw( false ), hqzsfw( false ), hgalfw( false ),
            hbdse( false ), hqzse( false ), hgale( false);

            // These are to hold data that no one parses.
         int idow(0);
         TimeSystem ts;

         for( TimeTag::IdToValue::iterator itr = info.begin();
              itr != info.end(); itr++ )
         {
            switch( itr->first )
            {
               case 'P':
                  ts.fromString(itr->second);
                  t.setTimeSystem(ts);
                  break;

               case 'Q':
                  hmjd = true;
                  break;

               case 'Z':
                  hzcount = true;
                  break;

               case 's':
                  hsod = true;
                  break;

               case 'g':
                  hsow = true;
                  break;

               case 'w':
                  idow = asInt( itr->second );
                  hdow = true;
                  break;

               case 'G':
                  hweek = true;
                  break;

               case 'F':
                  hfullweek = true;
                  break;

               case 'j':
                  hdoy = true;
                  break;

               case 'b':
               case 'B':
                  hmonth = true;
                  break;

               case 'Y':
               case 'y':
                  hyear = true;
                  break;

               case 'a':
               case 'A':
                  {
                     hdow = true;
                     string thisDay = firstWord( itr->second );
                     lowerCase(thisDay);
                     if (isLike(thisDay, "sun.*")) idow = 0;
                     else if (isLike(thisDay, "mon.*")) idow = 1;
                     else if (isLike(thisDay, "tue.*")) idow = 2;
                     else if (isLike(thisDay, "wed.*")) idow = 3;
                     else if (isLike(thisDay, "thu.*")) idow = 4;
                     else if (isLike(thisDay, "fri.*")) idow = 5;
                     else if (isLike(thisDay, "sat.*")) idow = 6;
                     else
                     {
                        hdow = false;
                     }
                  }
                  break;
                  
               case 'm':
                  hmonth = true;
                  break;

               case 'd':
                  hday = true;
                  break;

               case 'H':
                  hhour = true;
                  break;

               case 'M':
                  hmin = true;
                  break;

               case 'S':
                  hsec = true;
                  break;

               case 'f':
                  hsec = true;
                  // a small hack to make fractional seconds work
                  info['S'] = info['f'];
                  break;

               case 'U':
                  hunixsec = true;
                  break;

               case 'u':
                  hunixusec = true;
                  break;
                  
               case 'c':
                  hzcount29 = true;
                  break;

               case 'C':
                  hzcount32 = true;
                  break;

               case 'J':
                  hjulian = true;
                  break;
                  
               case 'K':
                  hansi = true;
                  break;
                  
               case 'E':
                  hepoch = true;
                  break;

               case 'R': hepoch = hbdse = true; break;
               case 'T': hepoch = hgale = true; break;
               case 'V': hepoch = hqzse = true; break;

               case 'D': hfullweek = hbdsfw = true; break;
               case 'e': hweek = hbdsw = true; break;
               case 'L': hfullweek = hgalfw = true; break;
               case 'l': hweek = hgalw = true; break;
               case 'I': hfullweek = hqzsfw = true; break;
               case 'i': hweek = hqzsw = true; break;

               default:
                  {
                     // do nothing
                  }
                  break;

            };
         }     // end loop over Id/Value pairs

         if( hyear )
         {
            if( hmonth && hday )
            {
               CivilTime tt;
               tt.setFromInfo( info );
               if( hsod )
               {
                  convertSODtoTime( asDouble( info['s'] ), 
                                    tt.hour, tt.minute, tt.second );
               }
               t = tt.convertToCommonTime();
               return;
            }
            else  // use YDSTime as default
            {
               YDSTime tt;
               tt.setFromInfo( info );
               if( hhour && hmin && hsec )
               {
                  tt.sod = convertTimeToSOD( asInt( info['H'] ), 
                                             asInt( info['M'] ), 
                                             asDouble( info['S'] ) );
               }
               t = tt.convertToCommonTime();
               return;
            }

         } // end of if( hyear )

         if( hzcount32 ||
             (hfullweek && hzcount) ||
             (hepoch && (hzcount29 || 
                         (hweek && hzcount))) )
         {
            GPSWeekZcount tt;
            tt.setFromInfo( info );
            t = tt.convertToCommonTime();
            return;
         }

         if ( (hepoch && hweek) || hfullweek )
         {
            WeekSecond* ptt;
            if(hbdse || hbdsfw || hbdsw) ptt = new BDSWeekSecond();
            else if(hqzse || hqzsfw || hqzsw) ptt = new QZSWeekSecond();
            else if(hgale || hgalfw || hgalw) ptt = new GALWeekSecond();
            else ptt = new GPSWeekSecond();
            ptt->setFromInfo(info);
            if( hdow && !hsow )
            {
               ptt->sow = asInt( info['w'] ) * SEC_PER_DAY;
               if( hsod )
               {
                  ptt->sow += asDouble( info['s'] );
               }
               else if( hhour && hmin && hsec )
               {
                  ptt->sow += convertTimeToSOD( asInt( info['H'] ), 
                                              asInt( info['M'] ), 
                                              asDouble( info['S'] ) );
               }
            }
            t = ptt->convertToCommonTime();
            return;
         }

         if( hmjd )
         {
            MJD tt;
            tt.setFromInfo( info );
            t = tt.convertToCommonTime();
            return;
         }

         if( hjulian )
         {
            JulianDate tt;
            tt.setFromInfo( info );
            t = tt.convertToCommonTime();
            return;
         }

         if( hansi )
         {
            ANSITime tt;
            tt.setFromInfo( info );
            t = tt.convertToCommonTime();
            return;
         } 
         
         if( hunixsec || hunixusec )
         {
            UnixTime tt;
            tt.setFromInfo( info );
            t = tt.convertToCommonTime();
            return;
         }

         InvalidRequest ir("Incomplete time specification for readTime");
         GPSTK_THROW( ir );
      }
      catch( gpstk::StringUtils::StringException& se )
      {
         GPSTK_RETHROW( se );
      }
   }   
Пример #11
0
   // Compute the conversion (in seconds) from one time system (inTS) to another
   // (outTS), given the year and month of the time to be converted.
   // Result is to be added to the first time (inTS) to yield the converted (outTS),
   // that is t(outTS) = t(inTS) + correction(inTS,outTS).
   // NB. the caller must not forget to change to outTS after adding this correction.
   // @param TimeSystem inTS, input system
   // @param TimeSystem outTS, output system
   // @param int year, year of the time to be converted.
   // @param int month, month (1-12) of the time to be converted.
   // @return double dt, correction (sec) to be added to t(in) to yield t(out).
   // @throw if input system(s) are invalid or Unknown.
   double TimeSystem::Correction(const TimeSystem& inTS,
                                 const TimeSystem& outTS,
                                 const int year,
                                 const int month,
                                 const double day)
   {
      double dt(0.0);

      // identity
      if(inTS == outTS)
         return dt;

      // cannot convert unknowns
      if(inTS == Unknown || outTS == Unknown) {
         Exception e("Cannot compute correction for TimeSystem::Unknown");
         GPSTK_THROW(e);
      }

      // compute TT-TDB here; ref Astronomical Almanac B7
      double TDBmTT(0.0);
      if(inTS == TDB || outTS == TDB) {
         int iday = int(day);
         long jday = convertCalendarToJD(year, month, iday) ;
         double frac(day-iday);
         double TJ2000(jday-2451545.5+frac);     // t-J2000
         //       0.0001657 sec * sin(357.53 + 0.98560028 * TJ2000 deg)
         frac = ::fmod(0.017201969994578 * TJ2000, 6.2831853071796);
         TDBmTT = 0.0001657 * ::sin(6.240075674 + frac);
         //        0.000022 sec * sin(246.11 + 0.90251792 * TJ2000 deg)
         frac = ::fmod(0.015751909262251 * TJ2000, 6.2831853071796);
         TDBmTT += 0.000022  * ::sin(4.295429822 + frac);
      }

      // -----------------------------------------------------------
      // conversions: first convert inTS->TAI ...
      // TAI = GPS + 19s
      // TAI = UTC + getLeapSeconds()
      // TAI = TT - 32.184s
      if(inTS == GPS ||       // GPS -> TAI
         inTS == GAL)         // GAL -> TAI
         dt = 19.;
      else if(inTS == UTC ||  // UTC -> TAI
              inTS == BDT ||  // BDT -> TAI           // TD is this right?
              inTS == GLO)    // GLO -> TAI
         dt = getLeapSeconds(year, month, day);
      //else if(inTS == BDT)    // BDT -> TAI         // RINEX 3.02 seems to say this
      //   dt = 34.;
      else if(inTS == TAI)    // TAI
         ;
      else if(inTS == TT)     // TT -> TAI
         dt = -32.184;
      else if(inTS == TDB)    // TDB -> TAI
         dt = -32.184 + TDBmTT;
      else {                              // other
         Exception e("Invalid input TimeSystem " + inTS.asString());
         GPSTK_THROW(e);
      }

      // -----------------------------------------------------------
      // ... then convert TAI->outTS
      // GPS = TAI - 19s
      // UTC = TAI - getLeapSeconds()
      // TT = TAI + 32.184s
      if(outTS == GPS ||      // TAI -> GPS
         outTS == GAL)        // TAI -> GAL
         dt -= 19.;
      else if(outTS == UTC || // TAI -> UTC
              outTS == BDT || // TAI -> BDT
              outTS == GLO)   // TAI -> GLO
         dt -= getLeapSeconds(year, month, day);
      //else if(outTS == BDT)   // TAI -> BDT
      //   dt -= 34.;
      else if(outTS == TAI)   // TAI
         ;
      else if(outTS == TT)    // TAI -> TT
         dt += 32.184;
      else if(outTS == TDB)   // TAI -> TDB
         dt += 32.184 - TDBmTT;
      else if(outTS == GAL)   // TD
         dt = 0.0;
      else {                              // other
         Exception e("Invalid output TimeSystem " + outTS.asString());
         GPSTK_THROW(e);
      }

      return dt;
   }