void Timespan::SetValue(const unsigned int days, const unsigned int hours, const unsigned int minutes, const double seconds) { time_span_ = static_cast<double> (days); AddHours(hours); AddMinutes(minutes); AddSeconds(seconds); }
void Duration::SetInfo(const ods::DurationInfo &info) { if (info_ == nullptr) info_ = new ods::DurationInfo(); info_->CopyFrom(info); /** <number:time-style style:name="N40"> <number:hours number:style="long"/> <number:text>:</number:text> <number:minutes number:style="long"/> </number:time-style> **/ /** enum class Order : quint8 { HOURS_MINUTES, HOURS_MINUTES_SECONDS }; **/ const auto order = info_->order(); if (order == ods::duration::Order::HOURS_MINUTES) { AddHours(); AddSeparator(0); AddMinutes(); } else if (order == ods::duration::Order::HOURS_MINUTES_SECONDS) { AddHours(); AddSeparator(0); AddMinutes(); AddSeparator(1); AddSeconds(); } QString s = info_->truncate_on_overflow() ? "true" : "false"; tag_->AttrSet(tag_->ns().number(), ods::style::kTruncateOnOverflow, s); }
FX_BOOL CFX_DateTime::AddSeconds(int32_t iSeconds) { if (iSeconds == 0) { return FALSE; } iSeconds += m_DateTime.Time.sTime.second; int32_t iMinutes = iSeconds / 60; iSeconds %= 60; if (iSeconds < 0) { iMinutes--, iSeconds += 60; } m_DateTime.Time.sTime.second = (uint8_t)iSeconds; if (iMinutes != 0) { AddMinutes(iMinutes); } return TRUE; }