本文整理汇总了C++中KDateTime::toTimeSpec方法的典型用法代码示例。如果您正苦于以下问题:C++ KDateTime::toTimeSpec方法的具体用法?C++ KDateTime::toTimeSpec怎么用?C++ KDateTime::toTimeSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDateTime
的用法示例。
在下文中一共展示了KDateTime::toTimeSpec方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recursAt
bool Recurrence::recursAt( const KDateTime &dt ) const
{
// Convert to recurrence's time zone for date comparisons, and for more efficient time comparisons
KDateTime dtrecur = dt.toTimeSpec( d->mStartDateTime.timeSpec() );
// if it's excluded anyway, don't bother to check if it recurs at all.
if ( d->mExDateTimes.containsSorted( dtrecur ) ||
d->mExDates.containsSorted( dtrecur.date() ) ) {
return false;
}
int i, end;
for ( i = 0, end = d->mExRules.count(); i < end; ++i ) {
if ( d->mExRules[i]->recursAt( dtrecur ) ) {
return false;
}
}
// Check explicit recurrences, then rrules.
if ( startDateTime() == dtrecur || d->mRDateTimes.containsSorted( dtrecur ) ) {
return true;
}
for ( i = 0, end = d->mRRules.count(); i < end; ++i ) {
if ( d->mRRules[i]->recursAt( dtrecur ) ) {
return true;
}
}
return false;
}
示例2: setMinDateTime
/******************************************************************************
* Set the minimum date/time, adjusting the entered date/time if necessary.
* If 'dt' is invalid, any current minimum date/time is cleared.
*/
void AlarmTimeWidget::setMinDateTime(const KDateTime& dt)
{
mMinDateTimeIsNow = false;
mMinDateTime = dt.toTimeSpec(mTimeSpec);
mDateEdit->setMinDate(mMinDateTime.date());
setMaxMinTimeIf(KDateTime::currentDateTime(mTimeSpec));
}
示例3: formatTime
QString Stringify::formatTime( const KDateTime &dt, bool shortfmt, const KDateTime::Spec &spec )
{
if ( spec.isValid() ) {
QString timeZone;
if ( spec.timeZone() != KSystemTimeZones::local() ) {
timeZone = ' ' + spec.timeZone().name();
}
return KGlobal::locale()->formatTime( dt.toTimeSpec( spec ).time(), !shortfmt ) + timeZone;
} else {
return KGlobal::locale()->formatTime( dt.time(), !shortfmt );
}
}
示例4: fromString
DateTime DateTime::fromString( const QString dts, const KDateTime::Spec &spec )
{
if (dts.isEmpty()) {
return DateTime();
}
KDateTime dt = KDateTime::fromString(dts);
if ( ! dt.isValid() ) {
// try to parse in qt default format (used in early version)
dt = KDateTime( QDateTime::fromString(dts), spec ).toLocalZone();
return dt.dateTime();
}
if ( dt.isClockTime() ) {
// timezone offset missing, set to spec
return DateTime( dt.toLocalZone().dateTime() );
}
DateTime t = DateTime( dt.toTimeSpec( spec ).toLocalZone().dateTime() );
return t;
}
示例5: dumpTime
QString dumpTime( const KDateTime &dt, const KDateTime::Spec &viewSpec )
{
if ( !dt.isValid() ) {
return QString();
}
KDateTime vdt = viewSpec.isValid() ? dt.toTimeSpec( viewSpec ) : dt;
QString format;
#ifdef FLOAT_IS_DATE_ONLY
if ( vdt.isDateOnly() ) {
format = QLatin1String( "%Y-%m-%d" );
} else
#endif
format = QLatin1String( "%Y-%m-%dT%H:%M:%S" );
if ( vdt.isSecondOccurrence() ) {
format += QLatin1String( " %Z" );
}
if ( vdt.timeSpec() != KDateTime::ClockTime ) {
format += QLatin1String( " %:Z" );
}
return vdt.toString( format );
}
示例6: formatDateTime
QString Stringify::formatDateTime( const KDateTime &dt, bool allDay,
bool shortfmt, const KDateTime::Spec &spec )
{
if ( allDay ) {
return formatDate( dt, shortfmt, spec );
}
if ( spec.isValid() ) {
QString timeZone;
if ( spec.timeZone() != KSystemTimeZones::local() ) {
timeZone = ' ' + spec.timeZone().name();
}
return KGlobal::locale()->formatDateTime(
dt.toTimeSpec( spec ).dateTime(),
( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) ) + timeZone;
} else {
return KGlobal::locale()->formatDateTime(
dt.dateTime(),
( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
}
}