如何将 C 中的 unix 时间戳作为 int 获取? [英] How do I get the unix timestamp in C as an int?
本文介绍了如何将 C 中的 unix 时间戳作为 int 获取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取当前时间戳并使用 fprintf
打印出来.
I would like to get the current timestamp and print it out using fprintf
.
推荐答案
对于 32 位系统:
fprintf(stdout, "%u
", (unsigned)time(NULL));
对于 64 位系统:
fprintf(stdout, "%lu
", (unsigned long)time(NULL));
这篇关于如何将 C 中的 unix 时间戳作为 int 获取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文