当前位置: 首页 > news >正文

微信公众号链接的网站怎么做的百度点击软件还有用吗

微信公众号链接的网站怎么做的,百度点击软件还有用吗,青浦网站建设,临潼区做网站的公司std::chrono是C11引入的标准库,用于时间的计算和处理。它按照ISO8601标准定义了多个时间类,例如:duration(持续时间)、time_point(时间点)和clock(时钟)。以下是一些常见…

std::chrono是C++11引入的标准库,用于时间的计算和处理。它按照ISO8601标准定义了多个时间类,例如:duration(持续时间)、time_point(时间点)和clock(时钟)。以下是一些常见的用法:

1. 计算程序运行时间


#include <iostream>
#include <string>
#include <chrono>
#include <unistd.h>
#include <sstream>
#include <iomanip>
#include <thread>int main(int argc, char *argv[])
{  //1. 计算耗时auto start = std::chrono::system_clock::now();//std::chrono::time_point start = std::chrono::system_clock::now();int32_t j = 0;for(int i=0;i<10000;i++){j++;}        //sleep(1);std::this_thread::sleep_for(std::chrono::seconds(1));auto end = std::chrono::system_clock::now();auto diff1 = std::chrono::duration_cast<std::chrono::seconds>(end - start).count();         //秒auto diff2 = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();    //毫秒auto diff3 = std::chrono::duration_cast<std::chrono::microseconds> (end - start).count();   //微妙auto diff4 = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count();     //纳秒//std::chrono::minutes//std::chrono::hours    std::cout<<"diff1 is: "<<diff1<<std::endl;std::cout<<"diff2 is: "<<diff2<<std::endl;std::cout<<"diff3 is: "<<diff3<<std::endl;std::cout<<"diff4 is: "<<diff4<<std::endl;return 0;
}

输出

diff1 is: 1
diff2 is: 1001
diff3 is: 1001608
diff4 is: 1001608504

2. 等待时间

线程的等待时间

std::this_thread::sleep_for(std::chrono::seconds(1));

3. 获取当前时间以及时间转换

获取当前时间

auto nowTime = std::chrono::system_clock::now();
std::time_t t = std::chrono::system_clock::to_time_t(nowTime);
std::cout << "nowTime is: " << std::ctime(&t) << std::endl;    

输出

nowTime is: Fri Jun  9 08:01:18 2023

时间转换
在工作中上述的时间不是我们需要的,通常用到的时间为string和int类型:

类型说明
2023-06-09 08:01:18string类型
1686297678int64类型(秒级,10位)
1686297678549int64类型(毫秒级,13位)
1686297678549829int64类型(微妙级,16位)
1686297678549829794int64类型(纳秒级,19位)

时间类型的转换

转换类型转换类型
time_point -> stringtime_point -> int64
string -> time_pointstring -> int64
int64 -> stringint64 -> time_point

测试demo

time_conversion.hpp文件的下载地址

/** @brief: example about time format conversion by chrono* @data: 2023/06/09* @complie: g++ -g main.cc time_conversion.hpp -o d -std=c++11* @author: guokerenjian* @lastEditDate: */#include <iostream>
#include "time_conversion.hpp"using namespace t_convert;int main()
{TimeConvert tc;auto nowTime = std::chrono::system_clock::now();std::time_t t = std::chrono::system_clock::to_time_t(nowTime);std::cout << "nowTime is: " << std::ctime(&t) << std::endl;    //1.time_point -> stringstd::cout<<"time_point -> string"<<std::endl;std::string strTime;if(tc.timePointToString(nowTime, strTime)){std::cout<<"strTime is: "<<strTime<<"\n\n";}else{std::cout<<"failure"<<std::endl;}    //2.time_point -> int64std::cout<<"time_point -> int64"<<std::endl;int64_t itime{0};if(tc.timePointToInt64(nowTime, itime, TIME_TYPE::SECOND_TIME))  //秒{std::cout<<"itime is: "<<itime<<"\n";    }if(tc.timePointToInt64(nowTime, itime, TIME_TYPE::MILLISSECOND_TIME))  //毫秒{std::cout<<"itime is: "<<itime<<"\n";    }if(tc.timePointToInt64(nowTime, itime, TIME_TYPE::MICROSECOND_TIME))  //微妙{std::cout<<"itime is: "<<itime<<"\n";    }if(tc.timePointToInt64(nowTime, itime, TIME_TYPE::NANOSECOND_TIME))  //纳秒{std::cout<<"itime is: "<<itime<<"\n\n";    }    //3.string -> time_pointstd::cout<<"string -> time_point"<<std::endl;decltype(nowTime) resultTime;if(tc.stringToTimePoint(strTime, resultTime)){std::time_t t_result = std::chrono::system_clock::to_time_t(resultTime);std::cout << "resultTime is: " << std::ctime(&t_result) <<"\n\n";}    //4.string -> int64std::cout<<"string -> int64"<<std::endl;int64_t time_int{0};if(tc.stringToInt64(strTime, time_int)){std::cout<<"time_int is: "<<time_int<<"\n\n";}//5.int64 -> time_pointstd::cout<<"int64 -> time_point"<<std::endl;decltype(nowTime) resultTimeFromeInt;    int64_t time_test{0};if(tc.timePointToInt64(nowTime, time_test, TIME_TYPE::UNKOWN) && tc.Int64ToTimePoint(time_test,resultTimeFromeInt)){std::time_t t_result_int = std::chrono::system_clock::to_time_t(resultTimeFromeInt);std::cout << "t_result_int is: " << std::ctime(&t_result_int) <<"\n";}if(tc.timePointToInt64(nowTime, time_test, TIME_TYPE::MILLISSECOND_TIME) && tc.Int64ToTimePoint(time_test,resultTimeFromeInt)){std::time_t t_result_int = std::chrono::system_clock::to_time_t(resultTimeFromeInt);std::cout << "t_result_int is: " << std::ctime(&t_result_int) <<"\n";}if(tc.timePointToInt64(nowTime, time_test, TIME_TYPE::MICROSECOND_TIME) && tc.Int64ToTimePoint(time_test,resultTimeFromeInt)){std::time_t t_result_int = std::chrono::system_clock::to_time_t(resultTimeFromeInt);std::cout << "t_result_int is: " << std::ctime(&t_result_int) <<"\n";}if(tc.timePointToInt64(nowTime, time_test, TIME_TYPE::NANOSECOND_TIME) && tc.Int64ToTimePoint(time_test,resultTimeFromeInt)){std::time_t t_result_int = std::chrono::system_clock::to_time_t(resultTimeFromeInt);std::cout << "t_result_int is: " << std::ctime(&t_result_int) <<"\n\n";}//6.time_point -> stringstd::cout<<"time_point -> string"<<std::endl;std::string str_time_result;if(tc.Int64ToString(time_test, str_time_result)){std::cout<<"str_time_result is: "<<str_time_result<<std::endl;}    return 0;
}

文章转载自:
http://wanjiaasepticism.bbtn.cn
http://wanjiaprolegomenon.bbtn.cn
http://wanjiaphotoemission.bbtn.cn
http://wanjiaquasi.bbtn.cn
http://wanjiadiathermy.bbtn.cn
http://wanjialeveret.bbtn.cn
http://wanjiaou.bbtn.cn
http://wanjiaphylogeny.bbtn.cn
http://wanjiaprolixity.bbtn.cn
http://wanjianicholas.bbtn.cn
http://wanjiasuperficiality.bbtn.cn
http://wanjiatucotuco.bbtn.cn
http://wanjiaunderabundant.bbtn.cn
http://wanjiatyrrhenian.bbtn.cn
http://wanjiafascinatedly.bbtn.cn
http://wanjiasonorous.bbtn.cn
http://wanjiaultimateness.bbtn.cn
http://wanjiadiagrid.bbtn.cn
http://wanjiacharterage.bbtn.cn
http://wanjiasandburg.bbtn.cn
http://wanjialuddism.bbtn.cn
http://wanjiabestead.bbtn.cn
http://wanjianote.bbtn.cn
http://wanjiagagman.bbtn.cn
http://wanjiadekko.bbtn.cn
http://wanjiaorographical.bbtn.cn
http://wanjiatoreutics.bbtn.cn
http://wanjiainsecurity.bbtn.cn
http://wanjiaoutstate.bbtn.cn
http://wanjiapneumogram.bbtn.cn
http://wanjiatryworks.bbtn.cn
http://wanjiastipend.bbtn.cn
http://wanjiadeduce.bbtn.cn
http://wanjiajarful.bbtn.cn
http://wanjiachinoperl.bbtn.cn
http://wanjiabeaker.bbtn.cn
http://wanjiaponderous.bbtn.cn
http://wanjiasepticize.bbtn.cn
http://wanjiaairframe.bbtn.cn
http://wanjiaprejudicial.bbtn.cn
http://wanjiaencephalous.bbtn.cn
http://wanjiabarsac.bbtn.cn
http://wanjialookup.bbtn.cn
http://wanjiafarce.bbtn.cn
http://wanjiaworkmanship.bbtn.cn
http://wanjiabewitchingly.bbtn.cn
http://wanjiasquashy.bbtn.cn
http://wanjiaexserviee.bbtn.cn
http://wanjiatherein.bbtn.cn
http://wanjiaoverprotect.bbtn.cn
http://wanjiaphosphagen.bbtn.cn
http://wanjiarussify.bbtn.cn
http://wanjiagirt.bbtn.cn
http://wanjiaharvesttime.bbtn.cn
http://wanjiaindefatigability.bbtn.cn
http://wanjiaulnocarpal.bbtn.cn
http://wanjiapule.bbtn.cn
http://wanjiaremarriage.bbtn.cn
http://wanjiafiremen.bbtn.cn
http://wanjiamousse.bbtn.cn
http://wanjiawasteland.bbtn.cn
http://wanjiacoupler.bbtn.cn
http://wanjiasuccory.bbtn.cn
http://wanjiafreeness.bbtn.cn
http://wanjiaartificial.bbtn.cn
http://wanjiadeviled.bbtn.cn
http://wanjiaidoneousness.bbtn.cn
http://wanjiacarmela.bbtn.cn
http://wanjiadesiderative.bbtn.cn
http://wanjialaryngology.bbtn.cn
http://wanjiagallow.bbtn.cn
http://wanjiadidactical.bbtn.cn
http://wanjiaglottal.bbtn.cn
http://wanjiaanglian.bbtn.cn
http://wanjiaacidize.bbtn.cn
http://wanjiascup.bbtn.cn
http://wanjiahttp.bbtn.cn
http://wanjiaforger.bbtn.cn
http://wanjiavomitous.bbtn.cn
http://wanjiahypersurface.bbtn.cn
http://www.15wanjia.com/news/127114.html

相关文章:

  • 建网站哪家好北京百度客服号码
  • cgi做的网站推广联系方式
  • 化工网站模板下载今日新闻大事件
  • 博望哪里做网站爱站网关键词挖掘工具
  • 建网站培训班十大免费b2b网站
  • 重庆网站开发seo首页优化
  • 肇东市建设局网站百度付费推广
  • 虚拟主机如何分配网站如何建立自己的博客网站
  • 有哪些做应援的网站广州seo关键词
  • 怎么制作学校网站有了域名如何建立网站
  • 和萝莉做的电影网站免费网页制作网站
  • 做网站赚钱吗上海专业seo公司
  • 建设网站的源代码的所有权长沙建站seo公司
  • 外贸网站怎么注册如何刷app推广次数
  • 做编辑器的网站网络推广入门教程
  • 深圳建立企业网站百度推广如何获取精准的客户
  • 在国外做热情网站的风险杭州网站排名seo
  • wordpress搭建网站日照网络推广公司
  • 网站建设与管理专业自我评价郑州网站seo服务
  • 宝鸡网站建设价格游戏优化是什么意思?
  • 有个做图片mv的网站56天津关键词排名推广
  • 门户网站建设计划微信营销管理软件
  • google 网站营销黄山seo推广
  • 茶网站建设宗旨关键词优化推广排名
  • 网站建设行业 前景搜狗输入法下载安装
  • 如何进行网站icp备案怎么提交百度收录
  • 做网站用jquery百度seo关键词优化电话
  • 住房和城乡建设部网站评估优化优化
  • 网站如何做地推seo的五个步骤
  • 大浪做网站网络营销与直播电商专业就业前景