2011-08-12 09:54:46     gettimeofday + 2010 distribution

Document created by Aaronwu Employee on Oct 16, 2013
Version 1Show Document
  • View in full screen mode

2011-08-12 09:54:46     gettimeofday + 2010 distribution

Shyam sundar (INDIA)

Message: 102915   

 

Hello world,

 

I am trying to use the gettimeofday() function in my application.

 

timeval t1;

 

gettimeofday(&t1, NULL);

 

But when I compile, I do get the error

 

‘timeval’ undeclared (first use in this function)

I am using the 2010 uclinux distrbution. The toolchain was downloaded from the source and compiled as per the document.

 

What could be the problem? I use bfin-uclinux-gcc to compile

QuoteReplyEditDelete

 

 

2011-08-12 10:25:51     Re: gettimeofday + 2010 distribution

Stuart Henderson (UNITED KINGDOM)

Message: 102916   

 

Hi,

 

I believe that should be:

 

struct timeval t1;

 

gettimeofday(&t1, 0);

also ensure you're including sys/time.h

 

Please let me now if this resolves your problem.

 

thanks,

Stu

QuoteReplyEditDelete

 

 

2011-08-13 00:48:40     Re: gettimeofday + 2010 distribution

Shyam sundar (INDIA)

Message: 102921   

 

Thanks Stuart,

 

I had included sys/time.h.

 

Adding the keyword struct to timeval solved it !

Attachments

    Outcomes