How do I get the unix timestamp in C as an int?

后端 未结 5 488
借酒劲吻你
借酒劲吻你 2020-12-07 22:05

I would like to get the current timestamp and print it out using fprintf.

5条回答
  •  遥遥无期
    2020-12-07 22:49

    For 32-bit systems:

    fprintf(stdout, "%u\n", (unsigned)time(NULL)); 
    

    For 64-bit systems:

    fprintf(stdout, "%lu\n", (unsigned long)time(NULL)); 
    

提交回复
热议问题