本文整理汇总了C++中TDateTime::Hour方法的典型用法代码示例。如果您正苦于以下问题:C++ TDateTime::Hour方法的具体用法?C++ TDateTime::Hour怎么用?C++ TDateTime::Hour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDateTime
的用法示例。
在下文中一共展示了TDateTime::Hour方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: ParseFromXMLTimeString
// ---------------------------------------------------------------------------
// TPresCondValidity::ParseFromXMLTimeString()
// ---------------------------------------------------------------------------
//
TInt TPresCondValidity::ParseFromXMLTimeString(const TDesC& aXMLTimeString,
TTime& aUTCDateTime)
{
OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ParseFromXMLTimeString()" ) );
OPENG_DP(D_OPENG_LIT( " ParseFromXMLTimeString aXMLTimeString = %S"),
&aXMLTimeString);
TInt err(KErrNone);
// Initializing the locale
TLocale myLocale, systemLocale;
myLocale.Refresh();
systemLocale.Refresh();
myLocale.SetDateFormat(EDateJapanese);
myLocale.SetDateSeparator('-',1);
myLocale.SetDateSeparator('-',2);
myLocale.SetDateSeparator('T',3);
myLocale.SetTimeFormat(ETime24);
myLocale.SetTimeSeparator(':',1);
myLocale.SetTimeSeparator(':',2);
myLocale.SetTimeSeparator(' ',3);
myLocale.Set();
TTime myTime;
TTime myUTCtime;
TChar uTCtimeSign(aXMLTimeString[23]); // 23 is ascii T
// parsing main time
TBuf<KPresDateTimeBufLength> dateTimeBuffer(aXMLTimeString);
dateTimeBuffer.Delete(KPresDTWithoutUTCLength-1,6);
dateTimeBuffer.Replace(KPresDTSeperatorPos,1,KPresSpaceString);
myTime.Parse(dateTimeBuffer);
// parsing utc time
TBuf<KPresDateTimeBufLength> uTCbuffer(aXMLTimeString);
uTCbuffer.Delete(0,KPresDTWithoutUTCLength);
myUTCtime.Parse(uTCbuffer);
TDateTime uTCDateTime = myUTCtime.DateTime();
// adding or substracting utc from main time
if(uTCtimeSign=='+') // if diff is positive
{
aUTCDateTime = myTime - TTimeIntervalHours(uTCDateTime.Hour());
aUTCDateTime = aUTCDateTime - TTimeIntervalMinutes(uTCDateTime.Minute());
}
else if(uTCtimeSign=='-')
{
aUTCDateTime = myTime + TTimeIntervalHours(uTCDateTime.Hour());
aUTCDateTime = aUTCDateTime + TTimeIntervalMinutes(uTCDateTime.Minute());
}
else
err = KErrArgument;
// putting the system locale back
systemLocale.Set();
return err;
}
示例3: CompareDate
TBool CHttpHdrTest::CompareDate(TDateTime aDate1, TDateTime aDate2)
{
return ((aDate1.Year() == aDate2.Year()) &&
(aDate1.Month() == aDate2.Month()) &&
(aDate1.Day() == aDate2.Day()) &&
(aDate1.Hour() == aDate2.Hour()) &&
(aDate1.Minute() == aDate2.Minute()) &&
(aDate1.Second() == aDate2.Second()) &&
(aDate1.MicroSecond() == aDate2.MicroSecond()));
}
示例4: Debug
GLDEF_C void Debug( TRefByValue<const TDesC> aText, ... )
{
#ifdef WINS
VA_LIST args;
VA_START( args, aText );
TBuf<KLogLineLength> buf;
buf.FormatList( aText, args );
RFileLogger logger;
TInt ret=logger.Connect();
if (ret==KErrNone)
{
logger.SetDateAndTime( EFalse,EFalse );
logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend );
TBuf<KLogTimeFormatLength> timeStamp;
TTime now;
now.HomeTime();
TDateTime dateTime;
dateTime = now.DateTime();
timeStamp.Format( KLogTimeFormat,
dateTime.Hour(), dateTime.Minute(),
dateTime.Second(), dateTime.MicroSecond() );
buf.Insert( 0, timeStamp );
logger.Write(buf);
}
logger.Close();
VA_END( args );
#else
RDebug::Print(aText);
#endif
}
示例5: WriteSolutionTagL
// -----------------------------------------------------------------------------
// CCapInfo::WriteSolutionTagL()
// Writes SyncSolutionsService solution data to capability object.
// -----------------------------------------------------------------------------
//
void CCapInfo::WriteSolutionTagL( const TDesC& aContentName,
const TSConSolutionInfo& aSolution )
{
TRACE_FUNC_ENTRY;
_LIT( KFormatUID, "UID=0x%08x" );
_LIT( KFormatName, "Name=%S" );
_LIT( KFormatDate, "Timestamp=%04d%02d%02dT%02d%02d%02dZ" );
WriteTagL( EExt, TXmlParser::EElementBegin );
WriteValueL( EXNam, aContentName );
TFileName temp;
temp.Format( KFormatUID, aSolution.iUid );
WriteValueL( EXVal, temp );
temp.Format( KFormatName, &aSolution.iSolutionName );
WriteValueL( EXVal, temp );
if ( aSolution.iTime.Int64() != 0 )
{
// write time
TDateTime time = aSolution.iTime.DateTime();
temp.Format( KFormatDate, time.Year(), time.Month() + 1,
time.Day() + 1, time.Hour(), time.Minute(), time.Second() );
WriteValueL( EXVal, temp );
}
WriteTagL( EExt, TXmlParser::EElementEnd );
TRACE_FUNC_EXIT;
}
示例6: 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;
}
示例7: LogDateTime
// ---------------------------------------------------------------------------
// TPresCondValidity::LogDateTime()
// ---------------------------------------------------------------------------
//
void TPresCondValidity::LogDateTime(TDateTime aDateTime)
{
OPENG_DP(D_OPENG_LIT( " %d, %d, %d, %d, %d, %d, %d"),
aDateTime.Year(), aDateTime.Month()+1, aDateTime.Day()+1,
aDateTime.Hour(), aDateTime.Minute(), aDateTime.Second(),
aDateTime.MicroSecond() );
}
示例8: FormatTimeSimple
void MemSpyEngineUtils::FormatTimeSimple( TDes& aBuf, const TTime& aTime )
{
const TDateTime dt = aTime.DateTime();
//
_LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" );
aBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() );
}
示例9: AddTime
void RTestExecuteLogServ::AddTime(TDes8& aLogBuffer)
{
TTime now;
now.UniversalTime();
TDateTime dateTime = now.DateTime();
_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
// add the current time
aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000));
}
示例10: MakeTimeStrMilli
void TAzenqosEngineUtils::MakeTimeStrMilli(TTime &time,TDes& str) //str should be at least 19 in length
{
const TInt KThousand = 1000;
TDateTime date = time.DateTime();
str.Format(KTimeStampMillisecFormat,date.Year()%2000,date.Month()+1,date.Day()+1,date.Hour(),date.Minute(),date.Second(),date.MicroSecond()*KThousand);
}
示例11: AddTime
void CSerialWriter::AddTime(TDes8& aLogBuffer)
{
TTime now;
now.UniversalTime();
TDateTime dateTime = now.DateTime();
_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
// add the current time
aLogBuffer.Append(KTEFNewLine) ;
aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000));
}
示例12: StartTimer
// -----------------------------------------------------------------------------
// CUpdateManager::StartTimer
//
// Start timer.
// -----------------------------------------------------------------------------
//
void CUpdateManager::StartTimer()
{
TTime time;
time.HomeTime();
TDateTime dateTime = time.DateTime();
iMins = dateTime.Hour() * 60 + dateTime.Minute();
TTimeIntervalMinutes interval(KMinFrequency - iMins % KMinFrequency);
time += interval;
At(time);
}
示例13: PrintCurrentTimeStamp
void CTe_RegConcurrentTestStepBase::PrintCurrentTimeStamp(TBool aStart)
{
TTime time;
time.UniversalTime();
TDateTime dateTime = time.DateTime();
TBuf<32> timeBuf;
timeBuf.Format(_L("%02d:%02d:%02d:%03d"), dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond());
TBuf<16> buf(aStart?_L("started"):_L("ended"));
_LIT(KTimeFormat, "%S in server %S %S at %S");
INFO_PRINTF5(KTimeFormat, &ConfigSection(), &GetServerName(), &buf, &timeBuf);
}
示例14: WriteWithTimeStamp
void CSheduleServerLog::WriteWithTimeStamp(const TDesC& aText)
{
TBuf<200> buf;
TTime now;
now.HomeTime();
TDateTime dateTime;
dateTime = now.DateTime();
buf.Format(_L("%02d.%02d:%02d:%06d "), dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond());
Write(buf);
Write(aText);
}
示例15: TimeFormat
void CRuleManager::TimeFormat(const TTime& aTime,TDes8& aDes)
{
TDateTime time = aTime.DateTime();
TInt hour,minute;
hour = time.Hour() ;
minute = time.Minute() ;
aDes.AppendNum(hour);
aDes.Append(':');
aDes.AppendNum(minute);
}