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


C++ TTime::FormatL方法代码示例

本文整理汇总了C++中TTime::FormatL方法的典型用法代码示例。如果您正苦于以下问题:C++ TTime::FormatL方法的具体用法?C++ TTime::FormatL怎么用?C++ TTime::FormatL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTime的用法示例。


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

示例1: WriteCurrentTimeL

LOCAL_C void WriteCurrentTimeL()
    {
    RFs fs;
    User::LeaveIfError( fs.Connect() );
    CleanupClosePushL(fs);
    HBufC8* text = HBufC8::NewLC(100);
    TPtr8 textptr(text->Des() );
// Date and Time display
    TTime time;
    time.HomeTime();
    TBuf<256> dateString;
    _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3");
    time.FormatL(dateString,KDate);
    textptr.Append(_L( "\r\n\t\tData:\t" ) );
    textptr.Append( dateString );
    _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B");
    time.FormatL(dateString,KTime);
    textptr.Append(_L( "\r\n\t\tTime:\t" ) );
    textptr.Append( dateString );
    textptr.Append(_L( "\r\n" ) );
    textptr.Append(_L( "\r\n" ) );
    WriteLogL(textptr , fs);
    CleanupStack::PopAndDestroy(text);
    CleanupStack::PopAndDestroy(&fs); //fs
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:25,代码来源:DRMHelperServer.cpp

示例2: AutoIntervalChangeAt

// ---------------------------------------------------------------------------
// CWlanBgScan::AutoIntervalChangeAt
// ---------------------------------------------------------------------------
//
TTime CWlanBgScan::AutoIntervalChangeAt()
    {
    TTime currentTime;
    currentTime.HomeTime();
    TDateTime change_time( currentTime.DateTime() );
    
#ifdef _DEBUG
    change_time = currentTime.DateTime();
    TBuf<KWlanBgScanMaxDateTimeStrLen> timeNow;
    TRAP_IGNORE( currentTime.FormatL( timeNow, KWlanBgScanDateTimeFormat ) );
    DEBUG1( "CWlanBgScan::AutoIntervalChangeAt() - time now: %S", &timeNow );
#endif
    
    switch( TimeRelationToRange( currentTime, iBgScanSettings.bgScanPeakStartTime, iBgScanSettings.bgScanPeakEndTime ) )
        {
        case ESmaller:
            {
            change_time.SetHour( iBgScanSettings.bgScanPeakStartTime / KGetHours );
            change_time.SetMinute( iBgScanSettings.bgScanPeakStartTime % KGetHours );
            change_time.SetSecond( KZeroSeconds );
            currentTime = change_time;
            break;
            }
        case EInsideRange:
            {
            change_time.SetHour( iBgScanSettings.bgScanPeakEndTime / KGetHours );
            change_time.SetMinute( iBgScanSettings.bgScanPeakEndTime % KGetHours );
            change_time.SetSecond( KZeroSeconds );
            currentTime = change_time;
            if( iBgScanSettings.bgScanPeakStartTime > iBgScanSettings.bgScanPeakEndTime )
                {
                DEBUG( "CWlanBgScan::AutoIntervalChangeAt() - peak end happens tomorrow" );
                currentTime += TTimeIntervalDays( KAddOneDay );
                }
            else
                {
                DEBUG( "CWlanBgScan::AutoIntervalChangeAt() - peak end happens today" );
                }
            break;
            }
        case EGreater:
            {
            change_time.SetHour( iBgScanSettings.bgScanPeakStartTime / KGetHours );
            change_time.SetMinute( iBgScanSettings.bgScanPeakEndTime % KGetHours );
            change_time.SetSecond( KZeroSeconds );
            currentTime = change_time;
            currentTime += TTimeIntervalDays( KAddOneDay );
            break;
            }
        }
    
#ifdef _DEBUG
    change_time = currentTime.DateTime();
    TBuf<KWlanBgScanMaxDateTimeStrLen> dbgString;
    TRAP_IGNORE( currentTime.FormatL( dbgString, KWlanBgScanDateTimeFormat ) );
    DEBUG1( "CWlanBgScan::AutoIntervalChangeAt() - interval change to occur: %S", &dbgString );
#endif
    
    return currentTime;
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:64,代码来源:wlanbgscan.cpp

示例3: GetTimeString

void GetTimeString(TTime t, TDes& aBuf)
{
	TBuf<5> time; 
	TTime now; now=GetTime();
	if ((now.DateTime().Year()==t.DateTime().Year()) 
	   && (now.DateTime().Month()==t.DateTime().Month())
	   && (now.DateTime().Day()==t.DateTime().Day()) ) {
		
		t.FormatL(time, _L("%F%H:%T"));
	} else {
		t.FormatL(time, _L("%F%D/%M"));
	}
	aBuf.Copy(time);
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:14,代码来源:medialistbox.cpp

示例4: NSmlGetDateAndTimeL

// --------------------------------------------------------------------------------
// void NSmlGetDateAndTimeL( TDes8& aDateBuffer, TDes8& aTimeBuffer )
// --------------------------------------------------------------------------------
LOCAL_C void NSmlGetDateAndTimeL( TDes8& aDateBuffer, TDes8& aTimeBuffer )
	{
	TTime time;
	time.HomeTime();
	HBufC* dateBuffer = HBufC::NewLC(64);
	TPtr ptrDateBuffer = dateBuffer->Des();
	HBufC* timeBuffer = HBufC::NewLC(64);
	TPtr ptrTimeBuffer = timeBuffer->Des();
	time.FormatL(ptrDateBuffer, _L("%D%M%Y%/0%1%/1%2%/2%3%/3"));
	time.FormatL(ptrTimeBuffer, _L("%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
	CnvUtfConverter::ConvertFromUnicodeToUtf8(aDateBuffer, ptrDateBuffer);
	CnvUtfConverter::ConvertFromUnicodeToUtf8(aTimeBuffer, ptrTimeBuffer);
	CleanupStack::PopAndDestroy(2); // dateBuffer, timeBuffer
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:17,代码来源:nsmldebug.cpp

示例5: WriteToLog

void CTestUtils::WriteToLog(TRefByValue<const TDesC> aFmt,...)
	{

	_LIT(KDateFormatString, "%D%M%*Y%1%/1%2%/2%3 %H%:1%T%:2%S ");
	_LIT(Kcr,"\r\n");
	iLogBuf->Des().Zero();
	TTime date;
	date.HomeTime();
	TBuf<18> dateString;
	
	TRAPD(error,date.FormatL(dateString,(KDateFormatString)));
	if(error)
	{
		dateString.Copy(_L("Invalid Date"));
	}
	iLogBuf->Des().Copy(dateString);
	
	VA_LIST list;
	VA_START(list,aFmt);

	iLogBuf->Des().AppendFormatList(aFmt,list);
	iLogBuf->Des().Append(Kcr);
	iLogBuf8->Des().Copy(*iLogBuf);
	iFile.Write(*iLogBuf8);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:25,代码来源:GmxmlTestUtils.cpp

示例6: TimerExpired

void CBuddycloudListComponent::TimerExpired(TInt aExpiryId) {
	if(aExpiryId == KDragTimerId) {
#ifdef __SERIES60_40__		
		if(iDraggingAllowed) {
			iDragVelocity = iDragVelocity * 0.95;		
			iScrollbarHandlePosition += TInt(iDragVelocity);		
			
			CBuddycloudListComponent::RepositionItems(false);
			RenderScreen();
			
			if(Abs(iDragVelocity) > 0.05) {
				iDragTimer->After(50000);
			}
		}
#endif
	}
	else if(aExpiryId == KTimeTimerId) {
#ifdef __3_2_ONWARDS__
		HBufC* aTitle = iEikonEnv->AllocReadResourceLC(R_LOCALIZED_STRING_APPNAME);
		SetTitleL(*aTitle);
		CleanupStack::PopAndDestroy();
#else
		TTime aTime;
		aTime.HomeTime();
		TBuf<32> aTextTime;
		aTime.FormatL(aTextTime, _L("%J%:1%T%B"));
	
		SetTitleL(aTextTime);
	
		TDateTime aDateTime = aTime.DateTime();
		iTimer->After((60 - aDateTime.Second() + 1) * 1000000);
#endif
	}
}
开发者ID:Persepoliss,项目名称:symbian-client,代码行数:34,代码来源:BuddycloudListComponent.cpp

示例7: Start

/*
 -------------------------------------------------------------------------------

 Class: CSimpleTimeout

 Method: Start

 Description: voip audio service - Start timeout counting

 Parameters: None

 Return Values: None

 Errors/Exceptions: None

 Status: Approved

 -------------------------------------------------------------------------------
 */
void CSimpleTimeout::Start(TTimeIntervalMicroSeconds aTimeout)
    {
    FTRACE(FPrint(_L("CSimpleTimeout::Start")));
    if (IsActive())
        {
        Cancel();
        }

    // Request timer
    TTime endTime;
    endTime.HomeTime();
    endTime = endTime + aTimeout;

    TInt64 miliseconds = aTimeout.Int64();
    miliseconds /= 1000;

    TBuf<30> dateString;
    endTime.FormatL(dateString, KFormatTimeStamp);
    iLog->Log(_L("Timer=%LD ms, EndTime=%S"), miliseconds, &dateString);

    // Store absolute timeout
    iTestCaseTimeout = endTime;

    // Taken from STIF engine
    // Note: iTimer.After() method cannot use because there needed
    // TTimeIntervalMicroSeconds32 and it is 32 bit. So then cannot create
    // timeout time that is long enough. At() uses 64 bit value=>Long enough.
    iTimer.At(iStatus, endTime);
    SetActive();
    }
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:49,代码来源:TimeoutController.cpp

示例8:

void CMainControlEngine::WriteLog16(TRefByValue<const TDesC> aFmt, ...)
{
#ifdef __WRITE_LOG__
	//UtilityTools::WriteLogsL(_L("WriteLog16"));
	TBuf<400> tBuf;
	VA_LIST	list;
	VA_START(list,aFmt);
	tBuf.Zero();
	tBuf.AppendFormatList(aFmt,list);
	VA_END(list);

	HBufC8* buf=CnvUtfConverter::ConvertFromUnicodeToUtf8L(tBuf);
	ASSERT(buf);
	CleanupStack::PushL(buf);

	TBuf<64>	time16;
	TBuf8<64>	time8;
	TTime	tTime;
	tTime.HomeTime();
	tTime.FormatL(time16, _L("%D%M%Y%2/%3 %H:%T:%S "));
	time8.Copy(time16);

	iFile.Write(time8);
	iFile.Write(*buf);
	iFile.Write(_L8("\x0a\x0d"));
	CleanupStack::PopAndDestroy(1);
	//UtilityTools::WriteLogsL(_L("WriteLog16 End"));
#endif
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:29,代码来源:MainControlEngine.cpp

示例9: FindorCreateScheduleL

TBool CMsvSendExe::FindorCreateScheduleL(RScheduler& aScheduler, TTime& aStartTime, const CMsvScheduleSettings& aSettings, TSchedulerItemRef& aRef)
	{
	aStartTime.UniversalTime();
	aStartTime += (TTimeIntervalMicroSeconds32) (KSchSendExeMinReschedule - KMsvSendExeOneMinute);
	TInt err = KErrNotFound;
	const TInt max = (KSchSendExeMaxReschedule - KSchSendExeMinReschedule) / KMsvSendExeOneMinute;

	for (TInt i = 0; err != KErrNone && i < max; i++)
		{
		aStartTime += (TTimeIntervalMicroSeconds32) KMsvSendExeOneMinute;
		CMsvScheduleSend::RoundUpToMinute(aStartTime);
		TRAP(err, CMsvScheduleSend::FindScheduleL(aScheduler, aStartTime, aRef));
		}

	if (err != KErrNone)
		{
		CMsvScheduleSend::CreateScheduleL(aScheduler, aSettings, aStartTime, aSettings.ValidityPeriod(), aRef);
		SCHSENDLOG(FLog(iFileName, _L("\t\tSchedule Created (Ref=%d) for:"), aRef.iHandle));
		}
	else
		SCHSENDLOG(FLog(iFileName, _L("\t\tSchedule Found (Ref=%d) for:"), aRef.iHandle));

#ifndef _MSG_NO_LOGGING
	TBuf<32> bufDate;
	aStartTime.FormatL(bufDate, _L("%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
	SCHSENDLOG(FLog(iFileName, _L("\t\t%S"), &bufDate));
#endif

	return (err == KErrNone);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:30,代码来源:SchSendExe.cpp

示例10: datePtr

JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatDate
(JNIEnv * aJni, jobject, jlong timeInMillis)
{
    std::auto_ptr<HBufC> dateString(HBufC::New(KMaxDateFormatSize));
    if (dateString.get() == 0)
    {
        return 0;
    }
    TPtr datePtr(dateString->Des());
    TBuf<KMaxDateFormatSize> dateStringBuf;

    // Java Date object is calculated by millisecs from 1.1.1970 0:00:00 GMT
    // Need conversion for Symbian TTime
    TInt64 timeNum = *reinterpret_cast<TInt64*>(&timeInMillis);
    TInt64 timeBeginNum =
        MAKE_TINT64(JavaUpperTimeFor1970, JavaLowerTimeFor1970);

    TTime timeBegin(timeBeginNum);
    TTimeIntervalMicroSeconds delta(timeNum * 1000);
    TTime time = timeBegin + delta;

    _LIT(KTestFormat, "%/0%1%/1%2%/2%3%/3");
    TRAP_IGNORE(time.FormatL(dateStringBuf, KTestFormat));
    datePtr.Append(dateStringBuf);

    return aJni->NewString(
               (const jchar*)datePtr.Ptr(), datePtr.Length());
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:28,代码来源:formatternative.cpp

示例11: ReadFieldAsTextL

HBufC* CAgentAddressbook::ReadFieldAsTextL(const CContactItemField& itemField)
	{
	if (itemField.Storage() == NULL || !itemField.Storage()->IsFull())
		return HBufC::NewL(0);

	switch (itemField.StorageType())
		{
		case KStorageTypeText:
			{
			CContactTextField* txtField = itemField.TextStorage();
			if (txtField == NULL)
				return HBufC::NewL(0);
			return txtField->Text().AllocL();
			}
		case KStorageTypeDateTime:
			{
			CContactDateField* dateField = itemField.DateTimeStorage();
			if (dateField == NULL)
				return HBufC::NewL(0);
			TTime time = dateField->Time();
			_LIT(KFORMAT_DATE, "%D%M%Y%/0%1%/1%2%/2%3%/3");
			TBuf<30> strTime;
			time.FormatL(strTime, KFORMAT_DATE);
			return strTime.AllocL();
			}
		default:
			return HBufC::NewL(0);
		}
	}
开发者ID:BwRy,项目名称:core-symbian,代码行数:29,代码来源:AgentAddressbook.cpp

示例12: ConstructL

// -----------------------------------------------------------------------------
// CDRMNotifierServer::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CDRMNotifierServer::ConstructL() 
    {
    RFs fs;

    // Ignore errors
    User::RenameThread( KNotifierThread );
    
    User::LeaveIfError( fs.Connect() );
    
    fs.Close();

#ifdef _DRM_TESTING
    _LIT( KLogFile, "notifier.txt" );
    TFileName logFile( KLogFile );
    TTime time;
    time.UniversalTime();
    
    time.FormatL( logFile, KDateTimeFormat );
    logFile.Append( KLogFile );

    iLog = CLogFile::NewL( logFile, ETrue );
    iLog->SetAutoFlush( ETrue );
    iLog->SetAutoNewline( ETrue );
    
    LOG( _L8( "DRM Server starting..." ) );
#endif
    iStorage = CDRMMessageStorage::NewL();
    
    LOG( _L8( "Notification Server started." ) );
    
    // Add the server to the scheduler.
    StartL( DRMNotifier::KServerName );
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:38,代码来源:DRMNotifierServer.cpp

示例13: TimeRelationToRange

// ---------------------------------------------------------------------------
// 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: ConstructL

// ---------------------------------------------------------------------------
// ConstructL, 2nd Constructor
// ---------------------------------------------------------------------------
//
void CBCTestLogger::ConstructL()
    {
    TInt err = KErrNone;    
    
    iEikEnv = CEikonEnv::Static();
    RFs tempServer = iEikEnv->FsSession();    
    
    // \BCTestLog directory created if doesn't exist
    err = tempServer.MkDir( KPathBase );
    if ( err == KErrAlreadyExists || err == KErrNone )  
        {
        err = KErrNone; // Directory already exists - no error
        }        
    else
        {
        User::Leave(err);
        }
        
    // Read version of bc test from realease_note.txt.
    RFile vFile;
    User::LeaveIfError( 
	    vFile.Open( tempServer, KVersionFile, EFileRead | EFileShareAny ) != KErrNone );                
    
    TBuf<KMaxLength> versionLine;
	ReadLineL( vFile, versionLine);
    vFile.Close();
    	    
    // Create autotest results log filename
    iAtLogFileName = KPathBase;
    iAtLogFileName.Append( AppCaption() );
    iAtLogFileName.Append( KBCTestLogEnd );    
    
    // Open log file for autotest results.
    // If the file already exists, replace it.
    err = iAtLogFile.Replace( tempServer,
                              iAtLogFileName,
                              EFileWrite | EFileStreamText );

    if (err != KErrNone)
        {
        User::Leave( err );
        }

    iBuf.Zero();
    // Write version of bc tester in log file.
    iBuf.Append( KVersion );    
    iBuf.Append( versionLine );
    iBuf.Append( KLineEnd );
    iBuf.Append( KGeneralLogInfo );
    TTime homeTime;
    homeTime.HomeTime();
    TBuf<KTempBufferLenth> tempBuf;
    homeTime.FormatL( tempBuf, KDateTimeFormat );    
    iBuf.Append( tempBuf );    
    iBuf.Append( KLogTwoLine );          
    WriteToFileL( iAtLogFile, iBuf );
    
    CreateMainLogL();
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:63,代码来源:bctestlogger.cpp

示例15: PrintTimeL

/**
 * Prints the current local time
 @param aTime Time to be printed in the specified format
 */
void CTestCalInterimApiSuiteStepBase::PrintTimeL(const TTime& aTime)
	{
	_LIT(KTimeFmt, 				"%F%Y%M%D-%H:%T:%S");
	_LIT(KTimeLocal, 			"Local time : %s");

	TBuf<32> buf;
	aTime.FormatL(buf, KTimeFmt);
	INFO_PRINTF2(KTimeLocal, buf.PtrZ());
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:13,代码来源:TestCalInterimApiSuiteStepBase.cpp


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