当前位置: 首页>>代码示例>>C++>>正文


C++ dateTime函数代码示例

本文整理汇总了C++中dateTime函数的典型用法代码示例。如果您正苦于以下问题:C++ dateTime函数的具体用法?C++ dateTime怎么用?C++ dateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dateTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: message

void FileLogger::handleMessage(QtMsgType type, const char *msg)
{
    if (type == QtDebugMsg)
    {
        QString message(msg);
        if (mFilterByLogMarker)
        {
            if(message.contains(KLogMarker))
            {
                QTextStream debugStream(&mDebugFile);
                QDateTime dateTime(QDateTime::currentDateTime());
                QString log2output = dateTime.toString("yyyy-MM-dd::hh:mm:ss.zzz") + " : " + message;
                debugStream<<log2output;
            }
            else
            {
                return;
            }
        }
        else
        {
            QTextStream debugStream(&mDebugFile);
            QDateTime dateTime(QDateTime::currentDateTime());
            QString log2output = dateTime.toString("yyyy-MM-dd::hh:mm:ss.zzz") + " : " + message;
            debugStream<<log2output<<endl;
        }
    }
}
开发者ID:jiecuoren,项目名称:rmr,代码行数:28,代码来源:mrdebug.cpp

示例2: setDateTime

void Validity::hideTime(bool hide)
{
	if (hide) {
		if (!midnight && endDate)
			setDateTime(dateTime().addDays(-1));
		midnight = true;
	} else {
		if (midnight && endDate)
			setDateTime(dateTime().addDays(1));
		midnight = false;
		setTime(mytime);
	}
	updateFormatString();
}
开发者ID:bizonix,项目名称:xca,代码行数:14,代码来源:validity.cpp

示例3: coordinate

/*
 This is _only_ called when QGeoPositionInfoValidator::valid() returns true for the position.
 This means that it is implied that:
 - (data.dwValidFields & GPS_VALID_LATITUDE) != 0
 - (data.dwValidFields & GPS_VALID_LONGITUDE) != 0
 - (data.dwValidFields & GPS_VALID_UTC_TIME) != 0

 This guarantees that the newly created position will be valid.
 If the code is changed such that this is no longer guaranteed then this method will need to be
 updated to test for those conditions.
*/
void QGeoPositionInfoSourceWinCE::dataUpdated(GPS_POSITION data)
{
    QGeoCoordinate coordinate(data.dblLatitude, data.dblLongitude);

    // The altitude is optional in QGeoCoordinate, so we do not strictly require that the
    // GPS_POSITION structure has valid altitude data in order to trigger an update.
    if ((data.dwValidFields & GPS_VALID_ALTITUDE_WRT_SEA_LEVEL) != 0)
        coordinate.setAltitude(data.flAltitudeWRTSeaLevel);

    QDate date(data.stUTCTime.wYear, data.stUTCTime.wMonth, data.stUTCTime.wDay);
    QTime time(data.stUTCTime.wHour, data.stUTCTime.wMinute, data.stUTCTime.wSecond,
               data.stUTCTime.wMilliseconds);

    QDateTime dateTime(date, time, Qt::UTC);

    QGeoPositionInfo pos(coordinate, dateTime);

    // The following properties are optional, and so are set if the data is present and valid in
    // the GPS_POSITION structure.
    if ((data.dwValidFields & GPS_VALID_SPEED) != 0)
        pos.setAttribute(QGeoPositionInfo::GroundSpeed, data.flSpeed);

    if ((data.dwValidFields & GPS_VALID_HEADING) != 0)
        pos.setAttribute(QGeoPositionInfo::Direction, data.flHeading);

    if ((data.dwValidFields & GPS_VALID_MAGNETIC_VARIATION) != 0)
        pos.setAttribute(QGeoPositionInfo::MagneticVariation, data.dblMagneticVariation);

    lastPosition = pos;
    emit positionUpdated(pos);
}
开发者ID:robclark,项目名称:qtmobility-1.1.0,代码行数:42,代码来源:qgeopositioninfosource_wince.cpp

示例4: PTR_CAST

Q3DateTimeEdit* ossimQtPropertyDateItem::dateTimeEditor()
{
   if(theDateTimeEditor)
   {
      return theDateTimeEditor;
   }
   if(getOssimProperty().valid())
   {
      ossimDateProperty* dateProperty = PTR_CAST(ossimDateProperty,
                                                 getOssimProperty().get());
      if(dateProperty)
      {
         
         theDateTimeEditor = new Q3DateTimeEdit(theListView);
         QTime time(dateProperty->getDate().getHour(),
                    dateProperty->getDate().getMin(),
                    dateProperty->getDate().getSec());
         QDate date(dateProperty->getDate().getYear(),
                    dateProperty->getDate().getMonth(),
                    dateProperty->getDate().getDay());
         
         QDateTime dateTime(date, time);
         dateTimeEditor()->setDateTime(dateTime);
         connect(theDateTimeEditor,
                 SIGNAL(valueChanged(const QDateTime& )),
                 this,
                 SLOT(valueChanged(const QDateTime&)));
      }
   }
开发者ID:star-labs,项目名称:star_ossim,代码行数:29,代码来源:ossimQtPropertyDateItem.cpp

示例5: label

  virtual QwtText label(double fracDays) const
  {
    Time timeFromFracDays(fracDays-m_startDateTime.date().dayOfYear()-m_startDateTime.time().totalDays());
    DateTime dateTime(m_startDateTime + timeFromFracDays);
    Date date = dateTime.date();
    Time time = dateTime.time();
    unsigned day = date.dayOfMonth();
    unsigned month = openstudio::month(date.monthOfYear());
    int hour = time.hours();
    int minutes = time.minutes();
    int seconds = time.seconds();

    QString s;

// zooming 
    double currentDuration = scaleDiv().upperBound() - scaleDiv().lowerBound();

    if (currentDuration < 1.0/24.0) // less than an hour
    {
      s.sprintf("%02d/%02d %02d:%02d:%02d", month, day, hour, minutes, seconds);
    }
    else if (currentDuration < 7.0) // less than a week
    {
      s.sprintf("%02d/%02d %02d:%02d", month, day, hour, minutes);
    }
    else // week or more
    {
      s.sprintf("%02d/%02d", month, day);
    }



    return s;
  }
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:34,代码来源:Plot2D.hpp

示例6: parseDate

static QString parseDate(const QString &monthStr, const QString &dayStr, const QString &timeStr)
{
    int month=strToMonth(monthStr),
        day=-1,
        h=-1,
        m=-1,
        s=-1;

    if(-1!=month)
    {
        day=dayStr.toInt();
        h=timeStr.mid(0, 2).toInt();
        m=timeStr.mid(3, 2).toInt();
        s=timeStr.mid(6, 2).toInt();

        if(s>-1)
        {
            QDateTime dateTime(QDate(QDate::currentDate().year(), month, day), QTime(h, m, s));
            if (dateTime.isValid())
                return QLocale().toString(dateTime);
        }
    }

    return monthStr+QChar(' ')+dayStr+QChar(' ')+timeStr;
}
开发者ID:shsorbom,项目名称:qt_practicum,代码行数:25,代码来源:logviewer.cpp

示例7: it

void Logger::log(const QString& facility, const QString& message, LogLevelE level)
{
    LogFilterMap::const_iterator it(m_filters.find(facility));

    if(it == m_filters.end())
        m_filters[facility] = true; // add to existing facilities, enabled by default.
    else if(!it.value())
        return; // filtered out!

    // manage unlikely out-of-range value.
    level = level >= NUM_SEVERITY_LEVELS ? info : level;

    if(!m_levels[level]) // check if severity level is filtered out.
        return;

    QString dateTime(QDate::currentDate().toString("yyyy-MM-dd") +
                     QTime::currentTime().toString(" hh:mm:ss:zzz"));

    // The logging levels are: [E]RROR [W]ARNING [I]NFORMATION [S]UCCESS.
    QString levelFacility(QString("EWIS")[level] + " " + facility);

    foreach(ILogTransport* transport, m_transports) {
        transport->appendTime(dateTime);
        transport->appendLevelAndFacility(level, levelFacility);
        transport->appendMessage(message);
    }
开发者ID:DE8MSH,项目名称:uno2iec,代码行数:26,代码来源:logger.cpp

示例8: data

bool Interface_GUIDialogNumeric::show_and_get_date(void* kodiBase, tm *date, const char *heading)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogNumeric::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!date || !heading)
  {
    CLog::Log(LOGERROR,
              "Interface_GUIDialogNumeric::%s - invalid handler data (date='%p', heading='%p') on "
              "addon '%s'",
              __FUNCTION__, static_cast<void*>(date), heading, addon->ID().c_str());
    return false;
  }

  SYSTEMTIME systemTime;
  CDateTime dateTime(*date);
  dateTime.GetAsSystemTime(systemTime);
  if (CGUIDialogNumeric::ShowAndGetDate(systemTime, heading))
  {
    dateTime = systemTime;
    dateTime.GetAsTm(*date);
    return true;
  }
  return false;
}
开发者ID:68foxboris,项目名称:xbmc,代码行数:29,代码来源:Numeric.cpp

示例9: method

/**
 * Create CompleteRevocationRefs element that describes communication with OSCP responder.
 * @param responderName OCSP responder name as represented in responder public certification. Format as RFC2253
 * @param digestMethodUri digest method URI that was used for calculating ocspResponseHash
 * @param ocspResponseHash Digest of DER encode OCSP response
 * @param producedAt ProduceAt field of OCSP response
 */
void digidoc::SignatureTM::setCompleteRevocationRefs(const std::string& responderName, const std::string& digestMethodUri,
        const std::vector<unsigned char>& ocspResponseHash, const struct tm& producedAt )
{
    dsig::DigestMethodType method(xml_schema::Uri(digestMethodUri.c_str()));
    dsig::DigestValueType value(xml_schema::Base64Binary(&ocspResponseHash[0], ocspResponseHash.size()));

    xades::DigestAlgAndValueType digest(method, value);

    xades::ResponderIDType responderId;
    responderId.byName(xml_schema::String(responderName.c_str()));

	xml_schema::DateTime dateTime( util::date::makeDateTime( producedAt ) );
    xades::OCSPIdentifierType ocspId(responderId, dateTime);
    ocspId.uRI(xml_schema::Uri("#N0"));

    xades::OCSPRefType ocspRef(ocspId);
    ocspRef.digestAlgAndValue(digest);


    xades::OCSPRefsType ocspRefs;
    ocspRefs.oCSPRef().push_back(ocspRef);

    xades::CompleteRevocationRefsType completeRevocationRefs;
    completeRevocationRefs.oCSPRefs(ocspRefs);
    completeRevocationRefs.id(xml_schema::Id("S0-REVOCREFS"));
    //return completeRevocationRefs;

    unsignedSignatureProperties()->completeRevocationRefs().push_back(completeRevocationRefs);
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:36,代码来源:SignatureTM.cpp

示例10: msg

void NewGeneDateTimeWidget::WidgetDataRefreshReceive(WidgetDataItem_DATETIME_WIDGET widget_data)
{

	if (!data_instance.code || !widget_data.identifier || !widget_data.identifier->code || *widget_data.identifier->code != "0" || (widget_data.identifier->flags != "s"
			&& widget_data.identifier->flags != "e"))
	{
		boost::format msg("Invalid widget refresh in NewGeneDateTimeWidget widget.");
		QMessageBox msgBox;
		msgBox.setText(msg.str().c_str());
		msgBox.exec();
		return;
	}

	if (widget_data.identifier->flags != data_instance.flags)
	{
		return;
	}

	QDate date_1970(1970, 1, 1);
	QTime time_12am(0, 0);
	QDateTime datetime_1970(date_1970, time_12am);

	QDateTime proposed_date_time = datetime_1970.addMSecs(widget_data.the_date_time);

	if (dateTime() != proposed_date_time)
	{
		setDateTime(proposed_date_time);
	}

}
开发者ID:daniel347x-github,项目名称:newgene,代码行数:30,代码来源:newgenedatetimewidget.cpp

示例11: dateTime

CString CMultipleRequestsDlg::InterpretInvoiceQueryResponse(
    IResponsePtr& response ) 
{

  CString msg;
  msg.Format ( "Status: Code = %d, Message = %S"
    ", Severity = %S", response->StatusCode, 
    (BSTR)response->StatusMessage, (BSTR)response->StatusSeverity );
    
  IInvoiceRetListPtr invoiceRetList = response->Detail;
    
  if (invoiceRetList != NULL ) 
  {
    int count = invoiceRetList->Count;
    for( int ndx = 0; ndx < count; ndx++ )
    {
      IInvoiceRetPtr invoiceRet = invoiceRetList->GetAt(ndx);

      CString tmp;
      _bstr_t txnID =  invoiceRet->TxnID->GetValue();
      COleDateTime dateTime( invoiceRet->TxnDate->GetValue() );
      _bstr_t refNumber = invoiceRet->RefNumber->GetValue();

      tmp.Format( "\r\n\tInvoice (%d): TxnID = %S, "
        "TxnDate = %s, RefNumber = %S",
        ndx, (BSTR)txnID, dateTime.Format(), (BSTR)refNumber );
      msg += tmp;
    }
  }
  return msg;
}
开发者ID:IntuitDeveloper,项目名称:QBXML_SDK13_Samples,代码行数:31,代码来源:MultipleRequestsDlg.cpp

示例12: setSpecialValueText

void DateTimeEdit::checkDateTimeChange(void) {
    this->blockSignals(true);
	if (itsUndefined) {
		if (itsPreviousDateTime == dateTime()) { // was undefined and did not change -> re-apply opacity effect
			// NOTE: if minimum date equals the date then the special value text is shown
			setSpecialValueText(itsSpecialValueText);
			QDateTimeEdit::setDateTime(minimumDateTime());
		}
		else {
			itsUndefined = false;
			setSpecialValueText("");
		}
		itsPreviousDateTime = dateTime();
	}
    this->blockSignals(false);
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:16,代码来源:DateTimeEdit.cpp

示例13: TRAP_IGNORE

// ---------------------------------------------------------------------------
// CWlanBgScan::TimeRelationToRange
// ---------------------------------------------------------------------------
//
CWlanBgScan::TRelation CWlanBgScan::TimeRelationToRange( const TTime& aTime, TUint aRangeStart, TUint aRangeEnd ) const
    {
#ifdef _DEBUG
    TBuf<KWlanBgScanMaxDateTimeStrLen> dbgString;
    TRAP_IGNORE( aTime.FormatL( dbgString, KWlanBgScanDateTimeFormat2 ) );
    DEBUG1( "CWlanBgScan::TimeRelationToRange() - time:  %S", &dbgString );
#endif
        
    TDateTime dateTime( aTime.DateTime() );
    
    TUint timeToCheck = ( dateTime.Hour() * KGetHours ) + dateTime.Minute();

    DEBUG2( "CWlanBgScan::TimeRelationToRange() - range: %04u - %04u", aRangeStart, aRangeEnd );

    CWlanBgScan::TRelation relation( ESmaller );
    
    if( aRangeStart == aRangeEnd )
        {
        DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" );
        relation = EGreater;
        }
    else if( aRangeStart > aRangeEnd )
        {
        DEBUG( "CWlanBgScan::TimeRelationToRange() - range crosses the midnight" );
        /**
         * As range crosses midnight, there is no way for the relation to be ESmaller.
         */
        if( timeToCheck < aRangeEnd || timeToCheck >= aRangeStart )
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" );
            relation = EInsideRange;
            }
        else
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" );
            relation = EGreater;
            }
        }
    else
        {
        if( timeToCheck < aRangeStart )
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: ESmaller" );
            relation = ESmaller;
            }
        else if( timeToCheck >= aRangeStart && timeToCheck < aRangeEnd )
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" );
            relation = EInsideRange;
            }
        else
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" );
            relation = EGreater;
            }
        }
    
    return relation;
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:63,代码来源:wlanbgscan.cpp

示例14: switch

void Validity::localTime(int state)
{
	if (midnight)
		return;
	switch (state) {
	case Qt::Checked:
		setTimeSpec(Qt::LocalTime);
		setDateTime(dateTime().toLocalTime());
		break;
	case Qt::Unchecked:
		setTimeSpec(Qt::UTC);
		setDateTime(dateTime().toUTC());
		break;
	}
	updateFormatString();
	setMyTime(time());
}
开发者ID:bizonix,项目名称:xca,代码行数:17,代码来源:validity.cpp

示例15: dateTime

/**
 * Shift the times in a log of a string property
 * @param logEntry :: the string property
 * @param timeShift :: the time shift.
 */
void ChangeTimeZero::shiftTimeOfLogForStringProperty(
    PropertyWithValue<std::string> *logEntry, double timeShift) const {
  // Parse the log entry and replace all ISO8601 strings with an adjusted value
  auto value = logEntry->value();
  if (checkForDateTime(value)) {
    DateAndTime dateTime(value);
    DateAndTime shiftedTime = dateTime + timeShift;
    logEntry->setValue(shiftedTime.toISO8601String());
  }
}
开发者ID:DiegoMonserrat,项目名称:mantid,代码行数:15,代码来源:ChangeTimeZero.cpp


注:本文中的dateTime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。