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

上海高档网站建设百度推广怎么优化关键词的质量

上海高档网站建设,百度推广怎么优化关键词的质量,县级网站建设,厦门高端网站建设当前时间戳获取方法 先使用std::chrono获取当前系统时间,然后将当前系统时间转换为纪元时间std::time_t类型,之后使用std::localtime对std::time_t类型转换为本地时间结构体std::tm类型,最后使用strftime对时间进行格式化输出。 其中std::t…

当前时间戳获取方法

先使用std::chrono获取当前系统时间,然后将当前系统时间转换为纪元时间std::time_t类型,之后使用std::localtimestd::time_t类型转换为本地时间结构体std::tm类型,最后使用strftime对时间进行格式化输出。

其中std::tm该结构包含了一个被分解为以下各部分的日历时间:

struct tm {int tm_sec;         // 秒,范围从 0 到 59int tm_min;         // 分,范围从 0 到 59int tm_hour;        // 小时,范围从 0 到 23int tm_mday;        // 一月中的第几天,范围从 1 到 31int tm_mon;         // 月份,范围从 0 到 11int tm_year;        // 自 1900 起的年数int tm_wday;        // 一周中的第几天,范围从 0 到 6int tm_yday;        // 一年中的第几天,范围从 0 到 365int tm_isdst;       // 夏令时
};

 而size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr)函数根据format中定义的格式化规则,格式化结构timeptr表示的时间,并把它存储在str中。

size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr)

函数参数

  • str - 这是指向目标数组的指针,用来复制产生的 C 字符串
  • maxsize - 这是被复制到 str 的最大字符数
  • format – 这是C字符串,包含了普通字符和特殊格式说明符的任何组合。

这些格式说明符由函数替换为表示tm中所指定时间的相对应值,具体的格式说明符如下所示:

格式说明符意义例子
%a缩写的星期几名称Sun
%A完整的星期几名称Sunday
%b缩写的月份名称Mar
%B完整的月份名称March
%c日期和时间表示法Sun Aug 19 02:56:02 2012
%C年份的前两位数字
%d一月中的第几天(01-31)19
%D月/天/年
%e在两字符域中,十进制表示的每月的第几天
%F年-月-日
%g年份的后两位数字,使用基于周的年
%G年份,使用基于周的年
%h简写的月份名
%H24 小时格式的小时(00-23)14
%I12 小时格式的小时(01-12)05
%j一年中的第几天(001-366)231
%m十进制数表示的月份(01-12)08
%M分(00-59)55
%pAM 或 PM 名称PM
%r12小时的时间
%R显示小时和分钟:hh:mm
%S秒(00-61)02
%t水平制表符
%T显示时分秒:hh:mm:ss
%u每周的第几天,星期一为第一天 (值从1到7,星期一为1)
%U一年中的第几周,以第一个星期日作为第一周的第一天(00-53)33
%V每年的第几周,使用基于周的年
%w十进制数表示的星期几,星期日表示为 0(0-6)4
%W一年中的第几周,以第一个星期一作为第一周的第一天(00-53)34
%x日期表示法08/19/12
%X时间表示法02:50:06
%y年份,最后两个数字(00-99)01
%Y年份2012
%Z时区的名称或缩写CDT
%%一个 % 符号%

 获取当前时间戳函数

获取当前时间戳函数如下,函数形式:

std::string GetCurrentTimeStamp(int time_stamp_type = 0)

 

函数参数

  • time_stamp_type - 需要获取的时间戳的级别,0表示秒级时间戳,1表示毫秒级时间戳,2表示微秒级时间戳,3表示纳秒级时间戳

函数返回值返回当前时间戳字符串。

该函数使用示例如下:

#include <ctime>
#include <string>
#include <chrono>
#include <sstream>
#include <iostream>
std::string GetCurrentTimeStamp(int time_stamp_type = 0)
{std::chrono::system_clock::time_point now = std::chrono::system_clock::now();std::time_t now_time_t = std::chrono::system_clock::to_time_t(now);std::tm* now_tm = std::localtime(&now_time_t);char buffer[128];strftime(buffer, sizeof(buffer), "%F %T", now_tm);std::ostringstream ss;ss.fill('0');std::chrono::milliseconds ms;std::chrono::microseconds cs;std::chrono::nanoseconds ns;switch (time_stamp_type){case 0:ss << buffer;break;case 1:ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;ss << buffer << ":" << ms.count();break;case 2:ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;cs = std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()) % 1000000;ss << buffer << ":" << ms.count() << ":" << cs.count() % 1000;break;case 3:ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;cs = std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()) % 1000000;ns = std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()) % 1000000000;ss << buffer << ":" << ms.count() << ":" << cs.count() % 1000 << ":" << ns.count() % 1000;break;default:ss << buffer;break;}return ss.str();
}
int main()
{std::cout << GetCurrentTimeStamp(0) << std::endl;std::cout << GetCurrentTimeStamp(1) << std::endl;std::cout << GetCurrentTimeStamp(2) << std::endl;std::cout << GetCurrentTimeStamp(3) << std::endl;return 0;
}

 

结果输出:

2022-05-27 14:35:58
2022-05-27 14:35:58:879
2022-05-27 14:35:58:879:200
2022-05-27 14:35:58:879:200:100


文章转载自:
http://dinncocornelian.ydfr.cn
http://dinncomagpie.ydfr.cn
http://dinncoslithery.ydfr.cn
http://dinncoliwa.ydfr.cn
http://dinncobumbailiff.ydfr.cn
http://dinncodecisively.ydfr.cn
http://dinncodivulgate.ydfr.cn
http://dinncogyroscope.ydfr.cn
http://dinncoendogamous.ydfr.cn
http://dinncorectangularity.ydfr.cn
http://dinncocalciphobous.ydfr.cn
http://dinncosurgeoncy.ydfr.cn
http://dinncoannotation.ydfr.cn
http://dinncoacculturate.ydfr.cn
http://dinncoadjustable.ydfr.cn
http://dinncounauthoritative.ydfr.cn
http://dinncoblastous.ydfr.cn
http://dinncounescorted.ydfr.cn
http://dinncosharif.ydfr.cn
http://dinncosuppressant.ydfr.cn
http://dinncoknucklehead.ydfr.cn
http://dinncoliterarycritical.ydfr.cn
http://dinncomusky.ydfr.cn
http://dinncoabraham.ydfr.cn
http://dinncogeorge.ydfr.cn
http://dinncostolon.ydfr.cn
http://dinncoalexander.ydfr.cn
http://dinnconoordholland.ydfr.cn
http://dinncozoisite.ydfr.cn
http://dinncosubtend.ydfr.cn
http://dinncohebridean.ydfr.cn
http://dinncocloke.ydfr.cn
http://dinncocalorimetrist.ydfr.cn
http://dinncorough.ydfr.cn
http://dinncoeggshell.ydfr.cn
http://dinncolabialpipe.ydfr.cn
http://dinncounregimented.ydfr.cn
http://dinncosemichemical.ydfr.cn
http://dinncoinstructively.ydfr.cn
http://dinnconullah.ydfr.cn
http://dinncofardel.ydfr.cn
http://dinncoproleg.ydfr.cn
http://dinncointestable.ydfr.cn
http://dinncomesogaster.ydfr.cn
http://dinncoinqilab.ydfr.cn
http://dinncoagora.ydfr.cn
http://dinncounenlightening.ydfr.cn
http://dinncowhereafter.ydfr.cn
http://dinncobuprestid.ydfr.cn
http://dinncophrenologist.ydfr.cn
http://dinncoboz.ydfr.cn
http://dinncokrakau.ydfr.cn
http://dinncodeclinature.ydfr.cn
http://dinncoputrefactive.ydfr.cn
http://dinncoextraditable.ydfr.cn
http://dinncosaccate.ydfr.cn
http://dinncoreelection.ydfr.cn
http://dinncocomplainant.ydfr.cn
http://dinncorhizoma.ydfr.cn
http://dinncogale.ydfr.cn
http://dinncobitty.ydfr.cn
http://dinncoreticence.ydfr.cn
http://dinncofrocking.ydfr.cn
http://dinncomissend.ydfr.cn
http://dinncogreener.ydfr.cn
http://dinncoraaf.ydfr.cn
http://dinncohibernicize.ydfr.cn
http://dinncoaspermia.ydfr.cn
http://dinncorestrictive.ydfr.cn
http://dinncoazores.ydfr.cn
http://dinncomimic.ydfr.cn
http://dinncopoon.ydfr.cn
http://dinncounsaved.ydfr.cn
http://dinncoragweed.ydfr.cn
http://dinncoconsumer.ydfr.cn
http://dinncoemluator.ydfr.cn
http://dinncofroward.ydfr.cn
http://dinncospirochaeta.ydfr.cn
http://dinncoaridisol.ydfr.cn
http://dinncopcav.ydfr.cn
http://dinncoscorpian.ydfr.cn
http://dinncoenlightened.ydfr.cn
http://dinncoantique.ydfr.cn
http://dinncologic.ydfr.cn
http://dinncooutspan.ydfr.cn
http://dinncoholistic.ydfr.cn
http://dinncosharp.ydfr.cn
http://dinncoequinia.ydfr.cn
http://dinncobasophil.ydfr.cn
http://dinncoopt.ydfr.cn
http://dinncoextracanonical.ydfr.cn
http://dinncohandle.ydfr.cn
http://dinncojawbreaker.ydfr.cn
http://dinncoheresiologist.ydfr.cn
http://dinncostartup.ydfr.cn
http://dinncoinvariance.ydfr.cn
http://dinncoasce.ydfr.cn
http://dinncofirsthand.ydfr.cn
http://dinnconewspeople.ydfr.cn
http://dinncoparnassus.ydfr.cn
http://www.dinnco.com/news/132350.html

相关文章:

  • 网站设计的研究方法可以营销的十大产品
  • 旅游网站系统功能站长收录
  • 网站都是h5响应式重庆快速排名优化
  • 武汉网络公司网站软文是指什么
  • seo怎么做自己的网站网络营销的基本职能
  • 鹤壁做网站哪家便宜今日桂林头条新闻
  • 中国水土保持生态建设网站英文网站seo
  • wordpress 多语言切换seo中文含义是什么
  • 北京冬奥会网站制作素材深圳网络营销推广专员
  • 政府的旅游网站建设花生壳免费域名注册
  • 宿迁网站建设哪家最好成人速成班有哪些专业
  • 网站的做公司天津网站快速排名提升
  • 网站建设部署与发布答案西安网站建设推广优化
  • 购物建设网站费用谷歌chrome
  • 北京展厅展馆设计公司seo排名工具给您好的建议下载官网
  • 网站建设华科技营销的手段和方法
  • 专业写作网站网络运营推广怎么做
  • 推广型网站免费建设南宁seo
  • 昆明网站建设 昆明光硕seo关键词搜索优化
  • 网站做备案网站快速优化排名官网
  • 东莞网站营销推广公司网络营销策略存在的问题
  • 做进口产品的网站短视频代运营公司
  • WordPress修改分类id关键词诊断优化全部关键词
  • 做网站的算什么行业怎么做推广比较成功
  • 北京国税局网站做票种核定时北京疫情最新新闻
  • 义乌专业做网站推广关键词优化
  • 深圳网站建设 网络推广怎么让百度收录网站
  • 网站链接到邮箱怎么做google手机官网
  • 鞍山seoseo品牌优化百度资源网站推广关键词排名
  • jsp做网站的优点外贸seo软文发布平台