Need to get Objective-c gettimeofday?

I am trying to use gettimeofday in Objective-C. However, I get these two problems:

  • 'Implicit declaration of' gettimeofday 'function invalid in C99

  • "The gettimeofday declaration must be imported from the Darwin.POSIX.sys.time module before it is needed."

I performed these imports:

#import <UIKit/UIKit.h> #include <time.h> 

But is the problem still persisting?

Thanks in advance. / Jbj

+6
source share
1 answer

import <sys/time.h> instead of #include <time.h>

in C time.h declares functions like time (), clock (), etc .; and In POSIX (OS specification) has all the C structure and macro, and it expands with the time interval functions in sys/time.h

+9
source

All Articles