在日常工作上,常常必须查验当前时间戳或将时间戳转换为日期。因此写了一个实用工具,便捷变换和朋友们共享。喜爱的请关心并关注点赞!
#include #include #include #include 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 1624964738
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明。