What is the difference between clock_t, time_t and struct tm?

前端 未结 3 536
花落未央
花落未央 2021-02-05 07:06

What is the difference between clock_t, time_t and struct tm?

struct tm looks like this:

struct tm{
int tm_sec;
int tm_min;
int tm_hour;         


        
3条回答
  •  花落未央
    2021-02-05 07:39

    C just says that:

    (C99, 7.23.1p3) "clock_t and time_t which are arithmetic types capable of representing times"

    In the glibc, the type time_t is an alias to long.

    In the GNU C library, time_t is equivalent to long int

    from http://www.gnu.org/software/libc/manual/html_node/Simple-Calendar-Time.html

提交回复
热议问题