本文整理汇总了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;
}
示例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);
}
示例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 );
}
示例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);
}
}
}