UNIX Programming. struct timeval how to print it (C-programming)

前端 未结 6 2022
慢半拍i
慢半拍i 2020-12-14 08:34

I am trying to print a value of type timeval. Actually I am able to print it, but I get the following warning:

Multiple markers at this line

  • format ‘%l
6条回答
  •  悲哀的现实
    2020-12-14 09:06

    Yes , timeval is defined like this

    struct timeval { 
        time_t      tv_sec; 
        suseconds_t tv_usec; 
    } 
    

    Using

    printf ("%ld.%06ld\n", usage.ru_stime.tv_sec, usage.ru_stime.tv_usec); 
    

    will surely of help.

提交回复
热议问题