本文整理汇总了C++中time_duration_type::ticks方法的典型用法代码示例。如果您正苦于以下问题:C++ time_duration_type::ticks方法的具体用法?C++ time_duration_type::ticks怎么用?C++ time_duration_type::ticks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类time_duration_type
的用法示例。
在下文中一共展示了time_duration_type::ticks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}
示例2: 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());
}
}
示例3:
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();
}
}
示例4: 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()));
}
示例5: 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()));
}
示例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()));
}