Ejemplo n.º 1
0
/***********************************************************************//**
 * @brief Write time reference into FITS header
 *
 * @param[in] hdu FITS extension.
 *
 * Writes or updates the time reference information in a FITS header.
 * Depending of whether the keyword "MJDREF" or the pair of keywords "MJDREFI"
 * and "MJDREFF" exist already in the header, the method either writes the
 * reference MJD as floating point value, or split into an integer and a
 * fractional part. If nothing has been written yet, splitting into an
 * integer and fractional part will be used as this preserves the highest
 * possible accuracy.
 *
 * The following additional keywords are written:
 *     TIMEUNIT
 *     TIMESYS
 *     TIMEREF
 *
 * Nothing is done if the HDU pointer is NULL.
 ***************************************************************************/
void GTimeReference::write(GFitsHDU* hdu) const
{
    // Continue only if HDU is valid
    if (hdu != NULL) {

        // Case A: use floating point reference MJD
        if (hdu->hascard("MJDREF")) {
            hdu->card("MJDREF",   mjdref(),   "[days] Time reference MJD");
            hdu->card("TIMEUNIT", timeunit(), "Time unit");
            hdu->card("TIMESYS",  timesys(),  "Time system");
            hdu->card("TIMEREF",  timeref(),  "Time reference");
        }

        // Case B: use fractional reference MJD
        else {
            hdu->card("MJDREFI",  mjdrefi(),  "[days] Integer part of time reference MJD");
            hdu->card("MJDREFF",  mjdreff(),  "[days] Fractional part of time reference MJD");
            hdu->card("TIMEUNIT", timeunit(), "Time unit");
            hdu->card("TIMESYS",  timesys(),  "Time system");
            hdu->card("TIMEREF",  timeref(),  "Time reference");
        }


    } // endif: HDU was valid

    // Return
    return;
}
Ejemplo n.º 2
0
//////////////////////////////////////////////////////////////////////
// Time Detail Functions
CWorldTimer::timeunit CWorldTimer::CTimeDetail::GetTimeUnit( void ) const
{
	timeunit tuRet=0;

	tuRet = m_dwDays*24*3600;

	timeunit tuSecOfDay = timeunit(m_dwHours*3600) + m_dwMinutes*60 + m_dwSeconds;
	tuRet += tuSecOfDay;

	return tuRet;
}
Ejemplo n.º 3
0
/***********************************************************************//**
 * @brief Print time reference
 *
 * @return String containing the time reference.
 ***************************************************************************/
std::string GTimeReference::print(void) const
{
    // Initialise result string
    std::string result;

    // Append header
    result.append("=== GTimeReference ===\n");

    // Append information
    result.append(parformat("MJD reference time")+str(mjdref())+"\n");
    result.append(parformat("Time unit")+timeunit()+"\n");
    result.append(parformat("Time system")+timesys()+"\n");
    result.append(parformat("Time reference")+timeref()+"\n");

    // Return
    return result;
}
Ejemplo n.º 4
0
	base_delayedcall(boost::asio::io_service &_io_service, int timeunitcount, handler _cb)
		:io_service(_io_service),timer( new boost::asio::deadline_timer(io_service, timeunit(timeunitcount)))
	{
	    BOOST_ASIO_WAIT_HANDLER_CHECK(handler, _cb) type_check;
 		timer->async_wait(boost::bind(*this, boost::function<void()>(_cb), _1));
	}