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


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

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


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

示例1: PopulateOffPeakListL

void CPigeonScheduledSend::PopulateOffPeakListL()
{
    //There are no existing off peak times set up
    //So no need to remember them
    iOffPeakList->Reset();

    TTime t;
    TDateTime d;
    t.HomeTime();
    t -= TTimeIntervalHours(1);
    d = t.DateTime();

    TTimeIntervalMinutes twoHours = 120;

    TMsvOffPeakTime current(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours);
    iOffPeakList->AppendL(current);

    t -= TTimeIntervalDays(1);
    d = t.DateTime();
    TMsvOffPeakTime yesterday(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours);
    iOffPeakList->AppendL(yesterday);

    t += TTimeIntervalDays(2);
    d = t.DateTime();
    TMsvOffPeakTime tomorrow(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours);
    iOffPeakList->AppendL(tomorrow);
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:27,代码来源:pigeonservermtm.cpp

示例2: DaylightSavingsAppliesL

TBool Util::DaylightSavingsAppliesL(const TTime& utc)
	{
	
	// This algorithm needs the first day of the week to be monday
	
	TDay oldStart;
	
	TLocale set;
	oldStart = set.StartOfWeek();
	set.SetStartOfWeek(EMonday);
	set.Set();
	
	TBuf<9> min;
	TBuf<9> max;
	
	utc.FormatL(min, KDaylightSavingsMinFormat);
	utc.FormatL(max, KDaylightSavingsMaxFormat);
	
	// Get times representing the first/last possible day of this 
	// year that daylight savings time change could change on
	
	TTime timeMin;
	User::LeaveIfError(timeMin.Set(min));
	TTime timeMax;
	User::LeaveIfError(timeMax.Set(max));

	// Find the last sunday in the respective months
	
	TTimeIntervalDays addMin(6 - timeMin.DayNoInWeek());
	TTimeIntervalDays addMax(6 - timeMax.DayNoInWeek());
	
	timeMin += addMin;
	timeMax += addMax;
	
	// The change happens at 1AM.
	TTimeIntervalHours hour(1);
	timeMin += hour;
	timeMax += hour;
	
	// Now we know which day the change occurs on.
	// Compare it to what the UTC is.

	TBool result = ((timeMin <= utc) && (timeMax > utc));
	
	// reset the first week day
	set.SetStartOfWeek(oldStart);
	set.Set();
	
	return result;
	
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:51,代码来源:util.cpp

示例3: TTimeIntervalSeconds

static struct tm& as_struct_tm (const time_t& t, struct tm& res)
{
    TTime us = UNIX_BASE + TTimeIntervalSeconds(t);
    TDateTime dt = us.DateTime();

    res.tm_sec  = dt.Second();
    res.tm_min  = dt.Minute();
    res.tm_hour = dt.Hour();
    res.tm_mday = dt.Day() + 1;
    res.tm_mon  = dt.Month();
    res.tm_year = dt.Year() - 1900;

    // EPOC32 counts the year day as Jan 1st == day 1
    res.tm_yday = us.DayNoInYear() - 1;

    // EPOC32 counts the weekdays from 0==Monday to 6==Sunday
    res.tm_wday = us.DayNoInWeek() + 1;
    if (res.tm_wday==7)
        res.tm_wday=0;	// Sunday==0 in a struct tm

    // newlib just sets this field to -1
    // tm_isdst doesn't really make sense here since we don't
    // know the locale for which to interpret this time.

    res.tm_isdst = -1;

    return res;
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:28,代码来源:time.cpp

示例4: StartsAt

EXPORT_C TBool StartsAt(const TMsvOffPeakTime& time1, const TTime& time2)
	{
	TDateTime dateTime2 = time2.DateTime();

	if(time1.Day() != time2.DayNoInWeek()) return EFalse;
	if(time1.Hour() != dateTime2.Hour()) return EFalse;
	if(time1.Minute() != dateTime2.Minute()) return EFalse;
	return ETrue;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:9,代码来源:t_schsendutils.cpp

示例5: DayNoInWeek

// ----------------------------------------------------------------------------
// MPXDbUtil::DayNoInWeek
// ----------------------------------------------------------------------------
//
TInt MPXDbUtil::DayNoInWeek()
    {
    MPX_FUNC("MPXDbUtil::DayNoInWeek");

    TTime now;  // in microseconds
    now.HomeTime();

    // Calculate number of days in this week
    TDay dayNo = now.DayNoInWeek();
    TDay firstDay = TLocale().StartOfWeek();
    TInt numDay(0);
    if (firstDay == ESunday)
        {
        numDay = dayNo + 1;
        }
    else
        {
        numDay = dayNo - firstDay;
        }

    return numDay;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:26,代码来源:mpxdbutil.cpp


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