How to access the fields of a timeval structure

后端 未结 4 580
说谎
说谎 2021-01-06 08:51

I\'m trying to print the values in a struct timeval variable as follows:

int main()  
{  

    struct timeval *cur;  
    do_gettimeofday(cur);          


        
4条回答
  •  [愿得一人]
    2021-01-06 09:03

    You need to include sys/time.h instead of time.h, struct timeval is defined in /usr/include/sys/time.h and not in /usr/include/time.h.

提交回复
热议问题