本文整理汇总了C++中time_duration_type::is_special方法的典型用法代码示例。如果您正苦于以下问题:C++ time_duration_type::is_special方法的具体用法?C++ time_duration_type::is_special怎么用?C++ time_duration_type::is_special使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类time_duration_type
的用法示例。
在下文中一共展示了time_duration_type::is_special方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: duration_put
//! Put time into an ostream
static void duration_put(const time_duration_type& td,
ostream_type& os)
{
if(td.is_special()) {
os << td.get_rep();
}
else {
charT fill_char = '0';
if(td.is_negative()) {
os << '-';
}
os << std::setw(2) << std::setfill(fill_char)
<< absolute_value(td.hours()) << ":";
os << std::setw(2) << std::setfill(fill_char)
<< absolute_value(td.minutes()) << ":";
os << std::setw(2) << std::setfill(fill_char)
<< absolute_value(td.seconds());
fractional_seconds_type frac_sec =
absolute_value(td.fractional_seconds());
if (frac_sec != 0) {
os << "."
<< std::setw(time_duration_type::num_fractional_digits())
<< std::setfill(fill_char)
<< frac_sec;
}
} // else
} // duration_put
示例2: add_time_duration
static time_rep_type add_time_duration(const time_rep_type& base,
time_duration_type td)
{
if(base.is_special() || td.is_special()) {
return(time_rep_type(base.get_rep() + td.get_rep()));
}
else {
return time_rep_type(base.time_count() + td.ticks());
}
}
示例3: subtract_time_duration
static time_rep_type subtract_time_duration(const time_rep_type& base,
const time_duration_type& td)
{
if(base.is_special() || td.is_special()) {
return(time_rep_type(base.get_rep() - td.get_rep()));
}
else {
return time_rep_type(base.time_count() - td.ticks());
}
}
示例4:
counted_time_rep(const date_type& d, const time_duration_type& time_of_day)
: time_count_(1)
{
if(d.is_infinity() || d.is_not_a_date() || time_of_day.is_special()) {
time_count_ = time_of_day.get_rep() + d.day_count();
//std::cout << time_count_ << std::endl;
}
else {
time_count_ = (d.day_number() * frac_sec_per_day()) + time_of_day.ticks();
}
}
示例5: get_time_rep
static time_rep_type get_time_rep(const date_type& day,
const time_duration_type& tod,
date_time::dst_flags /* dst */ = not_dst)
{
if(day.is_special() || tod.is_special()) {
if(day.is_not_a_date() || tod.is_not_a_date_time()) {
return time_rep_type(date_type(not_a_date_time),
time_duration_type(not_a_date_time));
}
else if(day.is_pos_infinity()) {
if(tod.is_neg_infinity()) {
return time_rep_type(date_type(not_a_date_time),
time_duration_type(not_a_date_time));
}
else {
return time_rep_type(day, time_duration_type(pos_infin));
}
}
else if(day.is_neg_infinity()) {
if(tod.is_pos_infinity()) {
return time_rep_type(date_type(not_a_date_time),
time_duration_type(not_a_date_time));
}
else {
return time_rep_type(day, time_duration_type(neg_infin));
}
}
else if(tod.is_pos_infinity()) {
if(day.is_neg_infinity()) {
return time_rep_type(date_type(not_a_date_time),
time_duration_type(not_a_date_time));
}
else {
return time_rep_type(date_type(pos_infin), tod);
}
}
else if(tod.is_neg_infinity()) {
if(day.is_pos_infinity()) {
return time_rep_type(date_type(not_a_date_time),
time_duration_type(not_a_date_time));
}
else {
return time_rep_type(date_type(neg_infin), tod);
}
}
}
return time_rep_type(day, tod);
}
示例6: add_time_duration
static time_rep_type add_time_duration(const time_rep_type& base,
time_duration_type td)
{
if(base.day.is_special() || td.is_special()) {
return split_timedate_system::get_time_rep(base.day, td);
}
if (td.is_negative()) {
time_duration_type td1 = td.invert_sign();
return subtract_time_duration(base,td1);
}
wrap_int_type day_offset(base.time_of_day.ticks());
date_duration_type day_overflow(static_cast< typename date_duration_type::duration_rep_type >(day_offset.add(td.ticks())));
return time_rep_type(base.day+day_overflow,
time_duration_type(0,0,0,day_offset.as_int()));
}
示例7: add_time_duration
static time_rep_type add_time_duration(const time_rep_type& base,
time_duration_type td)
{
if(base.day.is_special() || td.is_special()) {
return split_timedate_system::get_time_rep(base.day, td);
}
if (td.is_negative()) {
time_duration_type td1 = td.invert_sign();
return subtract_time_duration(base,td1);
}
wrap_int_type day_offset(base.time_of_day.ticks());
int_type doff = day_offset.add(td.ticks());
// std::cout << "day overflow: " << doff << std::endl;
// std::cout << "ticks: " << td.ticks() << std::endl;
date_duration_type day_overflow(static_cast<int_type>(doff));
// std::cout << "base: " << to_simple_string(base.day) << std::endl;
// std::cout << "overflow " << day_overflow.days() << std::endl;
return time_rep_type(base.day+day_overflow,
time_duration_type(0,0,0,day_offset.as_int()));
}
示例8: subtract_time_duration
static time_rep_type subtract_time_duration(const time_rep_type& base,
const time_duration_type& td)
{
if(base.day.is_special() || td.is_special())
{
return split_timedate_system::get_time_rep(base.day, -td);
}
if (td.is_negative()) {
time_duration_type td1 = td.invert_sign();
return add_time_duration(base,td1);
}
//std::cout << td.ticks() << std::endl;
wrap_int_type day_offset(base.time_of_day.ticks());
date_duration_type day_overflow(static_cast<int_type>(day_offset.subtract(td.ticks())));
// std::cout << "sub: " << base.time_of_day.ticks() << "|"
// << day_offset.as_int() << "|"
// << day_overflow.days() << std::endl;
return time_rep_type(base.day-day_overflow,
time_duration_type(0,0,0,day_offset.as_int()));
}