Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: implicit declaration of function 'gettimeofday' #24

Closed
seanm opened this issue Jun 12, 2015 · 3 comments
Closed

warning: implicit declaration of function 'gettimeofday' #24

seanm opened this issue Jun 12, 2015 · 3 comments

Comments

@seanm
Copy link
Contributor

seanm commented Jun 12, 2015

git master has a warning:

volume_io/Prog_utils/time.c:141:9: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration]

time.c starts with:

#if HAVE_SYS_TIME_H
# include <sys/time.h>
#else
# include <time.h>
#endif

I've confirmed that I don't get into "#if HAVE_SYS_TIME_H" and also confirmed that #including <sys/time.h> fixes the warning.

I'm on OS X and building with CMake. I don't know enough about MINC's build system to know why HAVE_SYS_TIME_H is not true for me.

Help? :)

Thanks.

@rdvincent
Copy link
Member

Is this really on master? I don't see gettimeofday() in the master branch.

In the short run, if you add a line to libminc/CMakeLists.txt on or around line 112:

CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)

you will probably be ok, if HAVE_CLOCK_GETTIME is not set. Looking over this code, I think I need to rework the options to reflect current system dependencies. clock_gettime() and associated constants are defined in <time.h>, but gettimeofday() depends on <sys/time.h>.

rdvincent pushed a commit that referenced this issue Jun 12, 2015
rdvincent pushed a commit that referenced this issue Jun 12, 2015
@rdvincent
Copy link
Member

@seanm Please see if the latest develop commit fixes the issue.

@seanm
Copy link
Contributor Author

seanm commented Jun 12, 2015

Ugh, indeed, I mean 'develop' branch... (I'm so used to mainline work being done in master.)

Your fix works, thanks!

@seanm seanm closed this as completed Jun 12, 2015
thewtex pushed a commit to thewtex/libminc that referenced this issue Aug 18, 2015
…ng an octal command line parameter. Created ParseLong() as a standard way of dealing with this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants