???????????????Linux?3?????????????4????time_t??struct timeb?? struct timeval??struct timespec??clock_t?? struct tm.

??????1??time_t????????????????????????1970????????????

???????????????<sys/time.h>?У??????? time_t time = time(NULL); ?????

??????2??struct timeb?????????????????????????????????????????????

    struct timeb
    {
        time_t time;
        unsigned short millitm;
        short timezone;
        short dstflag;
    };

?????????int ftime(struct timeb *tp);?????timeb??

???????????0????????-1??

??????3??struct timeval?????????????????????????

    struct timeval
    {
        long tv_sec; /* seconds */
        long tv_usec; /* microseconds */
    };

??????int gettimeofday(struct timeval *tv?? struct timezone *tz);?????

????struct timezone??????????

    struct timezone
    {
       int tz_minuteswest; /* ??Greewich????????????*/
       int tz_dsttime; /* ??????????? */
    };

??????4??struct timespec??????????????????????????? ???????????????

    struct timespec
    {
        time_t tv_sec; /* seconds */
        long tv_nsec; /* nanoseconds */
    };

????????????long clock_gettime (clockid_t which_clock?? struct timespec *tp); ???.

???????????????????????tp???????????????6???????????

????CLOCK_REALTIME               ?????????1970??1.1??????
????CLOCK_MONOTONIC              ???????????????????
????CLOCK_PROCESS_CPUTIME_ID     ???????????
????CLOCK_THREAD_CPUTIME_ID      ??????????
????CLOCK_REALTIME_HR            CLOCK_REALTIME??????汾
????CLOCK_MONOTONIC_HR           CLOCK_MONOTONIC??????汾