unix时间戳转换公式(unix时间戳在线转换工具使用)

来源:国外服务器 在您之前已被浏览:1 次
导读:目前正在解读《unix时间戳转换公式(unix时间戳在线转换工具使用)》的相关信息,《unix时间戳转换公式(unix时间戳在线转换工具使用)》是由用户自行发布的知识型内容!下面请观看由(国外主机 - www.2bp.net)用户发布《unix时间戳转换公式(unix时间戳在线转换工具使用)》的详细说明。
笨笨网美国主机,w ww.2 b p .n e t

日常工作中经常需要查看当前时间戳或者转换时间戳到日期,为此写了一个小工具,方便转换,分享给小伙伴,喜欢的请关注并点赞!

#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <time.h>int main(int argc,char *argv[]) { time_t newtime; if (2 == argc) { newtime = strtol(argv[1],NULL,10); char szBuff[30]; strftime(szBuff, sizeof(szBuff), "%Y/%m/%d %X", localtime(&newtime)); printf("%sn",szBuff); } else { time(&newtime); printf("%ldn",newtime); } exit(0);}

编译

gcc -Wall -o showtime showtime.c

使用

chmod +x showtimecp showtime /usr/local/bin/showtimeshowtime 1624964738unix时间戳转换公式(unix时间戳在线转换工具使用)
笨笨网美国主机,w ww.2 b p .n e t
提醒:《unix时间戳转换公式(unix时间戳在线转换工具使用)》最后刷新时间 2025-03-21 11:17:31,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《unix时间戳转换公式(unix时间戳在线转换工具使用)》该内容的真实性请自行鉴别。