33 #include <boost/date_time/posix_time/posix_time.hpp> 34 #include <boost/date_time/local_time/local_time.hpp> 45 bool get_time_t_from_ole_date(DATE src, time_t&
res)
48 if(TRUE != ::VariantTimeToSystemTime(src, &st))
60 char tmpbuf[200] = {0};
63 PRAGMA_WARNING_DISABLE_VS(4996)
64 pt = localtime(&time_);
68 strftime( tmpbuf, 199,
"%d.%m.%Y %H:%M:%S", pt );
71 std::stringstream strs;
72 strs <<
"[wrong_time: " << std::hex << time_ <<
"]";
82 char tmpbuf[200] = {0};
85 PRAGMA_WARNING_DISABLE_VS(4996)
86 pt = localtime(&time_);
90 strftime( tmpbuf, 199,
"%Y_%m_%d %H_%M_%S", pt );
93 std::stringstream strs;
94 strs <<
"[wrong_time: " << std::hex << time_ <<
"]";
103 return boost::posix_time::to_simple_string(time_);
110 char tmpbuf[200] = {0};
113 PRAGMA_WARNING_DISABLE_VS(4996)
116 strftime( tmpbuf, 199,
"%a, %d %b %Y %H:%M:%S GMT", pt );
125 PRAGMA_WARNING_DISABLE_VS(4244)
126 int days = tail/(60*60*24);
127 tail = tail%(60*60*24);
128 int hours = tail/(60*60);
130 int minutes = tail/(60);
134 res =
std::string() +
"d" + boost::lexical_cast<
std::string>(days) +
".h" + boost::lexical_cast<std::string>(hours) +
".m" + boost::lexical_cast<
std::string>(minutes) +
".s" + boost::lexical_cast<std::string>(seconds);
140 bool odbc_time_to_oledb_taime(
const SQL_TIMESTAMP_STRUCT& odbc_timestamp, DATE& oledb_date)
144 st.wYear = odbc_timestamp.year;
145 st.wDay = odbc_timestamp.day;
146 st.wHour = odbc_timestamp.hour ;
147 st.wMilliseconds = (WORD)odbc_timestamp.fraction ;
148 st.wMinute = odbc_timestamp.minute ;
149 st.wMonth = odbc_timestamp.month ;
150 st.wSecond = odbc_timestamp.second ;
152 if(TRUE != ::SystemTimeToVariantTime(&st, &oledb_date))
std::string get_time_str_v3(const boost::posix_time::ptime &time_)
std::string get_time_interval_string(const time_t &time_)
std::string get_time_str_v2(const time_t &time_)
std::string get_internet_time_str(const time_t &time_)
std::string get_time_str(const time_t &time_)