本文整理汇总了C++中TDateTime::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TDateTime::Set方法的具体用法?C++ TDateTime::Set怎么用?C++ TDateTime::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDateTime
的用法示例。
在下文中一共展示了TDateTime::Set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToPyDict
void AddToPyDict(python_ptr<PyObject> &dict, char* name, const TTime& value)
{
TDateTime epoch; epoch.Set(1970, EJanuary, 0, 0, 0, 0, 0);
TTime e(epoch);
TInt unixtime=0;
TTimeIntervalSeconds secs;
if (value!=TTime(0)) {
User::LeaveIfError(value.SecondsFrom(e, secs));
unixtime=secs.Int();
}
AddToPyDict(dict, name, unixtime);
}
示例2: as_ttime
static void as_ttime (const struct tm& p, TTime& res, TBool normalise=EFalse)
{
TDateTime dt;
TInt err = dt.Set(p.tm_year+1900, (enum TMonth)p.tm_mon, p.tm_mday-1,
p.tm_hour, p.tm_min, p.tm_sec, 0);
if (err == KErrNone)
{
res = dt;
return;
}
if (!normalise)
{
res = TInt64(-1);
return;
}
// Try to normalise things (for mktime)
dt.Set(p.tm_year+1900, EJanuary, 0, 0, 0, 0, 0);
res = dt;
res += TTimeIntervalMonths (p.tm_mon);
res += TTimeIntervalDays (p.tm_mday-1);
res += TTimeIntervalHours (p.tm_hour);
res += TTimeIntervalMinutes(p.tm_min);
res += TTimeIntervalSeconds(p.tm_sec);
}
示例3: ClearLogsL
void CSysApSimChanged::ClearLogsL()
{
TRACES( RDebug::Print( _L("CSysApSimChanged::ClearLogsL()") ) );
// Clear the event log.
CShareActive* active = new (ELeave) CShareActive;
CleanupStack::PushL( active );
active->StartL();
TDateTime dateTime;
dateTime.Set( 2100, EJanuary, 1, 0, 0, 0, 0 );
TTime date(dateTime);
/* TRACES( RDebug::Print( _L("CSysApSimChanged::ClearLogsL(): trying CLogClient::NewL") ) );
CLogClient* logClient = CLogClient::NewL( iFs );
logClient->ClearLog( date, active->iStatus );
*/
CActiveScheduler::Start();
// delete logClient;
CleanupStack::PopAndDestroy( active );
}
示例4: symbianDateToString
/*!
Returns localized string representation of given \a date
formatted with Symbian locale date format.
If \a short_format is true the format will be a short version.
Otherwise it uses a longer version.
*/
static QString symbianDateToString(const QDate &date, bool short_format)
{
int month = date.month() - 1;
int day = date.day() - 1;
int year = date.year();
TDateTime dateTime;
dateTime.Set(year, TMonth(month), day, 0, 0, 0, 0);
TTime timeStr(dateTime);
TBuf<KMaxLongDateFormatSpec*2> buffer;
TPtrC dateFormat;
if (short_format) {
dateFormat.Set(ptrGetShortDateFormatSpec(_s60Locale));
} else {
dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale));
}
TRAPD(err, ptrTimeFormatL(timeStr, buffer, dateFormat, *_s60Locale.GetLocale());)
if (err == KErrNone)
示例5: GetDateTimeFromConfig
TBool CDataWrapperBase::GetDateTimeFromConfig(const TDesC& aSectName, TDateTime& aResult)
{
TInt year , month , day , hour , minute, second, microsecond ;
// Fields
_LIT(KYear, "year");
_LIT(KMonth, "month");
_LIT(KDay, "day");
_LIT(KHour, "hour");
_LIT(KMinute, "minute");
_LIT(KSecond, "second");
_LIT(KMicrosecond, "microsecond");
TBool ret = ETrue ;
if ( !GetIntFromConfig( aSectName, KYear , year))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KMonth , month))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KDay, day))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KHour, hour))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KMinute , minute))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KSecond , second))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KMicrosecond , microsecond))
{
ret=EFalse;
}
if ( ret )
{
TMonth amonth ;
switch (month)
{
case 1:
amonth = EJanuary ;
break ;
case 2:
amonth = EFebruary ;
break ;
case 3 :
amonth = EMarch ;
break ;
case 4:
amonth = EApril ;
break ;
case 5:
amonth = EMay ;
break ;
case 6 :
amonth = EJune ;
break ;
case 7 :
amonth = EJuly ;
break ;
case 8 :
amonth = EAugust ;
break ;
case 9 :
amonth = ESeptember ;
break ;
case 10 :
amonth = EOctober ;
break ;
case 11 :
amonth = ENovember ;
break ;
case 12:
amonth = EDecember ;
break ;
default :
return ret ;
}
aResult.Set(year,amonth ,day,hour,minute,second,microsecond);
}
return ret ;
}