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


C++ TDateTime::SetMonth方法代码示例

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


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

示例1: ChineseToDateTime

//------------------------------------------------------
// Class:       TChineseCalendar
// Function:    ChineseToDateTime
// Arguments:   TDateTime &
//
// Comments:    This function converts the date held within
//				the TChineseCalendar class to a TDateTime format and 
//				places it in the TDateTime class provided.
//
// Return:      void
//------------------------------------------------------
EXPORT_C void TChineseCalendar::ChineseToDateTime(TDateTime &aDT)
	{
	TArithmeticalDate gregDate;
	TGregorianCalendar greg(iJulianDay);

	greg.GregFromJulianDay(gregDate,iJulianDay);

	aDT.SetMicroSecond(0);
	aDT.SetSecond(0);
	aDT.SetMinute(0);
	aDT.SetHour(0);
	aDT.SetMonth((TMonth)(gregDate.iMonth - KCalConvMonthOffsetByOne));
	aDT.SetDay(gregDate.iDay - KCalConvMonthOffsetByOne);
	aDT.SetYear(gregDate.iYear);
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:26,代码来源:Chinese.cpp

示例2: TimePackToRel

datetime_t TimePackToRel(const datepack_t *tp, bool_t Local)
{
    TDateTime Date;
    TTime ot;
	if (!tp) return INVALID_DATETIME_T;
    Date.SetYear(tp->Year);
    Date.SetMonth((TMonth)(tp->Month-1));
    Date.SetDay(tp->Day-1);
    Date.SetHour(tp->Hour);
    Date.SetMinute(tp->Minute);
    Date.SetSecond(tp->Second);

    ot = TTime(Date);

    if (Local) 
    {
#ifndef SYMBIAN90
        TLocale locale;
        TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset());
        ot -= universalTimeOffset;
        if (locale.QueryHomeHasDaylightSavingOn())
        {
            TTimeIntervalHours daylightSaving(1);
            ot -= daylightSaving;
        }
#else
        RTz TzServer;
        if (TzServer.Connect()==KErrNone)
        {
            CTzConverter* Converter = CTzConverter::NewL(TzServer); 
            Converter->ConvertToUniversalTime(ot);
            delete Converter;
            TzServer.Close();
        }
#endif
    }

    return SymbianToDateTime(ot);
}
开发者ID:ViFork,项目名称:ResInfo,代码行数:39,代码来源:date_symbian.cpp

示例3: ParseTimeStrMilliL

void TAzenqosEngineUtils::ParseTimeStrMilliL(const TDesC& str,TTime &time)
	{
		TInt instrlen = str.Length();
		if(str.Length() != KTimeStampMillisecStrLen )
			User::Leave(KErrBadName);

		TDateTime date;

		TPtrC ptr(0,0);
		TInt pos=0;
		TLex lex;
		TInt val;

		//_LIT(KTimeStampMillisecFormat,"%02d%02d%02d_%02d:%02d:%02d.%03d");

		///year
		ptr.Set(str.Mid(pos,2));
		pos+=2;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		val+=2000;
		User::LeaveIfError(date.SetYear(val));

		//month
		ptr.Set(str.Mid(pos,2));
		pos+=2;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		if(val<1 || val > 12)//month should be at least 1 so we can set as symbian format: month-1
			User::Leave(KErrGeneral);
		val--;//Symbian format EJanuary is 0
		User::LeaveIfError(date.SetMonth((TMonth)val));

		//day
		ptr.Set(str.Mid(pos,2));
		pos+=2;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		if(val<1 || val > 31)//day limit
			User::Leave(KErrGeneral);
		val--;//Symbian format EJanuary is 0
		User::LeaveIfError(date.SetDay(val));


		//skip '_'
		pos+=1;

		//HH
		ptr.Set(str.Mid(pos,2));
		pos+=2;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		if(val<0 || val > 23)//0 to 23 Hrs
			User::Leave(KErrGeneral);
		User::LeaveIfError(date.SetHour(val));

		//skip ':'
		pos+=1;

		//MM
		ptr.Set(str.Mid(pos,2));
		pos+=2;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		if(val<0 || val > 59)//0 to 59 mins
			User::Leave(KErrGeneral);
		User::LeaveIfError(date.SetMinute(val));

		//skip ':'
		pos+=1;

		//SS
		ptr.Set(str.Mid(pos,2));
		pos+=2;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		if(val<0 || val > 59)//0 to 59 Seconds
			User::Leave(KErrGeneral);
		User::LeaveIfError(date.SetSecond(val));

		//skip '.'
		pos+=1;

		//SSS
		ptr.Set(str.Mid(pos,3));
		pos+=3;
		lex.Assign(ptr);
		val=0;
		User::LeaveIfError(lex.Val(val));
		if(val<0 || val > 999999)//0 to 999999 MicroSeconds
			User::Leave(KErrGeneral);
		User::LeaveIfError(date.SetMicroSecond(val));

		time = date;
//.........这里部分代码省略.........
开发者ID:ykasidit,项目名称:AzqGenUtils,代码行数:101,代码来源:AzenqosEngineUtils.cpp

示例4: RunL


//.........这里部分代码省略.........
									ResetBtTimer();
									return;
									///////////////END not valid
								}

						////////// boyond here is the VALID case


						////////////set device's UTC time
						if(iSyncTimeWhenValid)
							{

										TTime devTime;
										devTime.HomeTime();
										TDateTime dt = devTime.DateTime();


										if(gpsdata.POS_UTC.Length() < 6 || gpsdata.DATE.Length() < 6)
										{
											//line not ready/full... do nothing
										}
										else
										{

											//All NMEA chars are ASCII

											dt.SetHour((gpsdata.POS_UTC[0]-48)*10+(gpsdata.POS_UTC[1]-48));
											dt.SetMinute((gpsdata.POS_UTC[2]-48)*10+(gpsdata.POS_UTC[3]-48));
											dt.SetSecond((gpsdata.POS_UTC[4]-48)*10+(gpsdata.POS_UTC[5]-48));


											dt.SetDay((gpsdata.DATE[0]-48)*10+(gpsdata.DATE[1]-48) -1);

											dt.SetMonth(TMonth((gpsdata.DATE[2]-48)*10+(gpsdata.DATE[3]-48) -1));

											dt.SetYear((gpsdata.DATE[4]-48)*10+(gpsdata.DATE[5]-48)+KY2K);



											if(gpsdata.POS_UTC.Length()>9 && gpsdata.POS_UTC.Find(_L8("."))>0)
											{
												dt.SetMicroSecond((gpsdata.POS_UTC[7]-48)*KONEHUNDREDTHOUSAND+(gpsdata.POS_UTC[8]-48)*KTENTHOUSAND+(gpsdata.POS_UTC[9]-48)*1000);
											}

											devTime = dt;
											devTime += proctime;
#ifdef EKA2
											User::SetUTCTime(devTime);
#else
											//TODO: detect timezone and add accordingly
											TTime hometime(devTime);
											hometime += TTimeIntervalHours(7);
											User::SetHomeTime(hometime);
#endif


											iSyncTimeWhenValid = EFalse;

											CAknConfirmationNote* informationNote = new (ELeave) CAknConfirmationNote(EFalse);
											//informationNote->SetTimeout(CAknNoteDialog::EShortTimeout);
											_LIT(KConfirmText,"GPS TimeSync Successful");
											informationNote->ExecuteLD(KConfirmText);
											//TODO: report to scheduler that device time has changed? OR let scheduler detect device time change?


										}
开发者ID:ykasidit,项目名称:AzqLocmon,代码行数:67,代码来源:AzqBtGPSReader.cpp


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