Format specifier to print time(0) in C

前端 未结 5 1632
南方客
南方客 2021-01-22 06:18

We can declare a variable to hold the current time from the system using:

time_t now = time(0);

time(0) can also be use in genera

5条回答
  •  广开言路
    2021-01-22 07:09

    On most system time_t is define on the same number of bit than integer and is always positive.

    In this case you can use:

     printf("time: %u", (unsigned int) time(0));
    

提交回复
热议问题