⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time_base.cc

📁 有关MYSQL的开源码
💻 CC
字号:
#include "mysqlcppapi/datetime/time_base.h"#if defined(__GNUC__) && __GNUC__ < 3// hack for GCC 2.9x# include <ostream.h>#else# include <ostream>#endif#include <iomanip>#include <cstdlib>namespace mysqlcppapi{time_base::time_base(){}time_base::~time_base(){}std::ostream& time_base::out_stream(std::ostream& s) const{  char fill = s.fill('0');  std::ios::fmtflags flags = s.setf(std::ios::right);  s << std::setw(2) << hour << ':'     << std::setw(2) << minute << ':'    << std::setw(2) << second;  s.flags(flags);  s.fill(fill);  return s;}std::string::size_type time_base::convert(const std::string& str){  std::string::size_type i = 0;  std::stringstream buf;  buf << str.substr(i, 2) << ' ';  i += 2;  if (str.at(i) == ':') ++i;    buf << str.substr(i, 2) << ' ';  i += 2;  if (str.at(i) == ':') ++i;  const std::string& strSecond = str.substr(i, 2);  buf << strSecond;  i += strSecond.size();  buf >> hour >> minute >> second;  return i;}short int time_base::compare(const time_base* other) const{  if (short h = hour - other->hour)    return h;  if (short m = minute - other->minute)    return m;  return second - other->second;}} //namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -