コード例 #1
0
ファイル: date_facet.hpp プロジェクト: imos/icfpc2015
 OutItrT put(OutItrT next,
             std::ios_base& a_ios,
             char_type fill_char,
             const date_type& d) const
 {
   if (d.is_special()) {
     return do_put_special(next, a_ios, fill_char, d.as_special());
   }
   //The following line of code required the date to support a to_tm function
   return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format);
 }
コード例 #2
0
ファイル: time_system_split.hpp プロジェクト: 3DJ/ofxOgre
 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);
 }
コード例 #3
0
ファイル: date.hpp プロジェクト: ngzHappy/cpc2
 duration_type operator-(const date_type& d) const
 {
   if (!this->is_special() && !d.is_special())
   {
     // The duration underlying type may be wider than the date underlying type.
     // Thus we calculate the difference in terms of two durations from some common fixed base date.
     typedef typename duration_type::duration_rep_type duration_rep_type;
     return duration_type(static_cast< duration_rep_type >(days_) - static_cast< duration_rep_type >(d.days_));
   }
   else
   {
     // In this case the difference will be a special value, too
     date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_);
     return duration_type(val.as_special());
   }
 }