本文整理汇总了C++中TDateTime::SetSecond方法的典型用法代码示例。如果您正苦于以下问题:C++ TDateTime::SetSecond方法的具体用法?C++ TDateTime::SetSecond怎么用?C++ TDateTime::SetSecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDateTime
的用法示例。
在下文中一共展示了TDateTime::SetSecond方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: Today
// ----------------------------------------------------------------------------
// MPXDbUtil::Today
// ----------------------------------------------------------------------------
//
TTime MPXDbUtil::Today()
{
MPX_FUNC("MPXDbUtil::Today");
TTime now; // in microseconds
now.HomeTime();
TDateTime todayDate = now.DateTime();
todayDate.SetHour(0);
todayDate.SetMinute(0);
todayDate.SetSecond(0);
todayDate.SetMicroSecond(0);
return TTime(todayDate);
}
示例3: MonthStart
// ----------------------------------------------------------------------------
// MPXDbUtil::MonthStart
// ----------------------------------------------------------------------------
//
TTime MPXDbUtil::MonthStart()
{
MPX_FUNC("MPXDbUtil::MonthStart");
TTime now; // in microseconds
now.HomeTime();
TDateTime lastMonthStartDate = now.DateTime();
lastMonthStartDate.SetDay(0); // Day range from 0 to 30
lastMonthStartDate.SetHour(0);
lastMonthStartDate.SetMinute(0);
lastMonthStartDate.SetSecond(0);
lastMonthStartDate.SetMicroSecond(0);
return TTime(lastMonthStartDate);
}
示例4: TimeSet
void CRuleManager::TimeSet(const TDesC& aDes,TTime& aTime)
{
TTime time;
time.HomeTime();
TDateTime date;
date = time.DateTime();
TInt pos = aDes.Locate(':');
if (pos != KErrNotFound)
{
date.SetHour(CCommonUtils::StrToInt(aDes.Left(pos)));
date.SetMinute(CCommonUtils::StrToInt(aDes.Mid(pos+1)));
date.SetSecond(0);
date.SetMicroSecond(0);
}
aTime = TTime(date);
}
示例5: 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);
}
示例6: 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;
//.........这里部分代码省略.........
示例7: RunL
//.........这里部分代码省略.........
data.Zero();
iState = EReading;
iSendingSocket.RecvOneOrMore(data, 0, iStatus, iReadDataLength);
SetActive();
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");