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


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

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


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

示例1: IsTimeBeforeL

/*
-------------------------------------------------------------------------
-------------------------------------------------------------------------
*/
TBool CExPolicy_Server::IsTimeBeforeL(TTime& aTime,TTime& aCompare)
{
	TBool IsBefore(EFalse);
	TTimeIntervalMinutes MinInterval(0);
	TTimeIntervalHours 	 HourInterval(0);
	TTimeIntervalSeconds SecInterval(0);
	
	TTime TimeNow;
	TimeNow.HomeTime();
	
	TTimeIntervalDays DaysInterval = aTime.DaysFrom(aCompare);
	if(DaysInterval.Int() <= 0)
	{
		aTime.HoursFrom(aCompare,HourInterval);
		if(HourInterval.Int() <= 0)
		{
			aTime.MinutesFrom(aCompare,MinInterval);
			if(MinInterval.Int() <= 0)
			{
				aTime.SecondsFrom(aCompare, SecInterval);
				if(SecInterval.Int() <= 0)
				{
					IsBefore = ETrue;
				}
			}
		}
	}
	
	return IsBefore;
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:34,代码来源:ExampleServer.cpp

示例2: ConvertRepeatToAgnL

// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ConvertRepeatToAgnL
// Makes conversion from framework PIM item repeat rule to native entry repeat.
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ConvertRepeatToAgnL(
    const MPIMEventItem& aEventItemData, CCalEntry& aAgnEntry)
{
    JELOG2(EPim);
    const MPIMRepeatRuleData* repeatRuleData = aEventItemData.GetRepeat();

    TTime eventStart = aAgnEntry.StartTimeL().TimeUtcL();

    TCalRRule agnRRule = PIMRepeatRuleConverter::ConvertSupportedRepeatToAgnL(
                             *repeatRuleData, eventStart);

    if ((aAgnEntry.EntryTypeL() == CCalEntry::EAnniv) && (agnRRule.Type()
            != TCalRRule::EYearly))
    {
        User::Leave(KErrArgument);
    }

    if (agnRRule.Type() == TCalRRule::EWeekly)
    {
        __ASSERT_ALWAYS(agnRRule.Interval() <= 2, User::Leave(KErrArgument));
    }
    else // other than weekly
    {
        __ASSERT_ALWAYS(agnRRule.Interval() == 1, User::Leave(KErrArgument));
    }

    // Use local time to check the day since UTC times provide incorrect
    // results if the compared dates are near midnight
    TTime untilLocal = agnRRule.Until().TimeLocalL();
    TTime startLocal = aAgnEntry.StartTimeL().TimeLocalL();
    // Validate that repeat rule is correct. The end of the repeat rule
    // must be greater than the event start and it must not be within
    // the same day as the start of the event
    if (untilLocal != Time::NullTTime())
    {
        __ASSERT_ALWAYS(untilLocal >= startLocal, User::Leave(KErrAbort));
        TTimeIntervalDays intervalDays = untilLocal.DaysFrom(startLocal);
        // Interval smaller than one day. Check that the day is not the same
        if (intervalDays < TTimeIntervalDays(1))
        {
            __ASSERT_ALWAYS(untilLocal.DateTime().Day()
                            != startLocal.DateTime().Day(), User::Leave(KErrAbort));
        }
    }

    // Repeat Rules OK
    aAgnEntry.SetRRuleL(agnRRule);
    CopyExceptionDatesToAgnL(*repeatRuleData, aAgnEntry);
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:54,代码来源:cpimagneventadapter.cpp

示例3: CreateMainLogL

// ---------------------------------------------------------------------------
// CBCTestLogger::CreateMainLogL
// ---------------------------------------------------------------------------
//
void CBCTestLogger::CreateMainLogL()
    {
    RFile mainFile;
    RFs tempServer = iEikEnv->FsSession();
    TInt err = mainFile.Create( tempServer, KMainLog, 
        EFileWrite | EFileStreamText );
    if ( err != KErrNone )
        {
        if ( err == KErrAlreadyExists )
            {
            TInt errnum = mainFile.Open( tempServer, KMainLog, 
                EFileRead | EFileStreamText );
            if ( errnum != KErrNone )
                {
                return;
                }
            }
        }    
    CleanupClosePushL( mainFile );
    
    if ( err == KErrNone )
        {
        WriteToFileL( mainFile,  iBuf );
        }
    else if ( err == KErrAlreadyExists )
        {
        TTime modifiedTime;
        TTime homeTime;
        homeTime.HomeTime();
        err = mainFile.Modified( modifiedTime );
        if ( err == KErrNone )
            {
            TTimeIntervalDays days = homeTime.DaysFrom( modifiedTime );
            TInt interval = days.Int();
            if ( interval >= KTheMaxInterval || interval <= -KTheMaxInterval )
                {
                mainFile.Close();
                mainFile.Replace( tempServer, KMainLog,
                    EFileWrite | EFileStreamText );                
                WriteToFileL( mainFile,  iBuf );
                }
            }     
        }
    
    CleanupStack::PopAndDestroy( &mainFile );
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:50,代码来源:bctestlogger.cpp

示例4: AppendTimeDifference

void AppendTimeDifference(TDes8& aInto, TTime from, TTime now)
{
	CALLSTACKITEM_N(_CL("CLocaLogicImpl"), _CL("~CLocaLogicImpl"));


	if (from > now) {
		TTime s=from;
		from=now;
		now=s;
	}
	for(;;) {
		TTimeIntervalMinutes mins;
		if (now.MinutesFrom(from, mins)!=KErrNone) {
			mins=61;
		} 
		TTimeIntervalHours hours;
		if (now.HoursFrom(from, hours)!=KErrNone) {
			hours=25;
		} 
		TTimeIntervalDays days;
		days=now.DaysFrom(from);
		if (mins < TTimeIntervalMinutes(60)) {
			aInto.AppendNum(mins.Int());
			aInto.Append(_L8(" minutes "));
			break;
		} else if ( hours < TTimeIntervalDays(24)) {
			aInto.AppendNum(hours.Int());
			aInto.Append(_L8(" hours "));
			from+=TTimeIntervalHours(hours);
		} else {
			aInto.AppendNum(days.Int());
			aInto.Append(_L8(" days "));
			from+=TTimeIntervalDays(days);
		}
	}
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:36,代码来源:loca_logic.cpp


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