TheChess
|
00001 /* 00002 * thechess, chess game web application written in C++ and based on Wt 00003 * Copyright (C) 2010 Boris Nagaev 00004 * 00005 * thechess is licensed under the GNU GPL Version 2. 00006 * Other versions of the GPL do not apply. 00007 * See the LICENSE file for terms of use. 00008 */ 00009 00010 #ifndef THECHESS_TIME_INTERVALS_ 00011 #define THECHESS_TIME_INTERVALS_ 00012 00013 #include <string> 00014 #include <boost/date_time/posix_time/posix_time_types.hpp> 00015 00016 #include <Wt/WDateTime> 00017 00018 namespace thechess { 00019 00020 namespace ptime = boost::posix_time; 00021 00022 typedef ptime::time_duration Td; 00023 00024 const Td td_null = ptime::seconds(0); 00025 const Td second = ptime::seconds(1); 00026 const Td minute = ptime::minutes(1); 00027 const Td hour = ptime::hours(1); 00028 const Td day = hour * 24; 00029 const Td week = day * 7; 00030 00031 std::string td2str(const Td& td); 00032 Td operator -(const Wt::WDateTime& a, const Wt::WDateTime& b); 00033 Wt::WDateTime operator +(const Wt::WDateTime& a, const Td& b); 00034 Wt::WDateTime operator -(const Wt::WDateTime& a, const Td& b); 00035 Wt::WDateTime& operator +=(Wt::WDateTime& a, const Td& b); 00036 Wt::WDateTime& operator -=(Wt::WDateTime& a, const Td& b); 00037 Td operator /(const Td& a, const double& b); 00038 Td operator *(const Td& a, const double& b); 00039 Td operator *(const double& b, const Td& a); 00040 double operator /(const Td& a, const Td& b); 00041 Wt::WDateTime now(); 00042 00043 } 00044 00045 #endif