00001
00002
00003
00004
00005
00006
00013 #ifndef TK11_TIME_HPP
00014 #define TK11_TIME_HPP
00015
00016 #include <boost/date_time/posix_time/posix_time.hpp>
00017
00018 namespace tk11 {
00019
00021
00024 typedef boost::posix_time::ptime Time;
00025
00027
00030 typedef boost::posix_time::time_duration Duration;
00031
00032
00034
00037 using ::boost::posix_time::microsec;
00038
00040
00043 using ::boost::posix_time::millisec;
00044
00046
00049 using ::boost::posix_time::seconds;
00050
00052
00055 using ::boost::posix_time::minutes;
00056
00058
00061 using ::boost::posix_time::hours;
00062
00063
00065
00068 static const Time not_a_time = ::boost::posix_time::not_a_date_time;
00069
00071
00074 static Time positive_infinity = ::boost::posix_time::pos_infin;
00075
00077
00080 static Time negative_infinity = ::boost::posix_time::neg_infin;
00081
00082
00084
00087 static const Duration not_a_duration = ::boost::posix_time::not_a_date_time;
00088
00090
00093 static Duration positive_infinite_duration = ::boost::posix_time::pos_infin;
00094
00096
00099 static Duration negative_infinite_duration = ::boost::posix_time::neg_infin;
00100
00101
00103
00121 template<typename Int>
00122 Int time_div_int(const Duration& t1, const Duration& t2) {
00123 return Int(t1.ticks() / t2.ticks());
00124 }
00125
00127
00146 template<typename Float>
00147 Float time_div_float(const Duration& t1, const Duration& t2) {
00148 return Float(t1.ticks()) / Float(t2.ticks());
00149 }
00150
00151 }
00152
00153 #endif