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

[build error]gettimeofday is undefined #20

Closed
old-memories opened this issue Oct 9, 2022 · 4 comments
Closed

[build error]gettimeofday is undefined #20

old-memories opened this issue Oct 9, 2022 · 4 comments

Comments

@old-memories
Copy link
Contributor

old-memories commented Oct 9, 2022

eqcow2/qcow2.cpp: In constructor ‘MetaFlushingState::MetaFlushingState(Qcow2TopTable&, bool)’:
qcow2/qcow2.cpp:917:2: error: ‘gettimeofday’ was not declared in this scope; did you mean ‘SYS_gettimeofday’?
917 | gettimeofday(&last_flush, NULL);
| ^~~~~~~~~~~~
| SYS_gettimeofday
qcow2/qcow2.cpp: In member function ‘void MetaFlushingState::__done(Qcow2State&, ublksrv_queue*)’:
qcow2/qcow2.cpp:1121:2: error: ‘gettimeofday’ was not declared in this scope; did you mean ‘SYS_gettimeofday’?
1121 | gettimeofday(&last_flush, NULL);
| ^~~~~~~~~~~~
| SYS_gettimeofday
qcow2/qcow2.cpp: In member function ‘bool MetaFlushingState::__need_flush(int)’:
qcow2/qcow2.cpp:1324:3: error: ‘gettimeofday’ was not declared in this scope; did you mean ‘SYS_gettimeofday’?
1324 | gettimeofday(&t, NULL);
| ^~~~~~~~~~~~
| SYS_gettimeofday
make[2]: *** [Makefile:750: ublk-qcow2.o] Error 1
make[2]: Leaving directory '/root/work/ubdsrv'
make[1]: *** [Makefile:828: all-recursive] Error 1
make[1]: Leaving directory '/root/work/ubdsrv'
make: *** [Makefile:476: all] Error 2

Maybe we should include <sys/time.h> in qcow2/qcow2.h? I did so and it succeeded.

@ming1
Copy link
Collaborator

ming1 commented Oct 9, 2022

Maybe we should include <sys/time.h> in qcow2/qcow2.h? I did so and it > succeeded.

OK, care to send one MR?

BTW, not trigger in my test environment(fedora).

thanks,

@ming1
Copy link
Collaborator

ming1 commented Oct 9, 2022

Looks it is better to use system_clock of libstdc++, given qcow2 is basically
done via c++, and I will fix this issue.

@ming1
Copy link
Collaborator

ming1 commented Oct 9, 2022

Fixed by c4995da ("qcow2: replace gettimeofday with std::chrono::system_clock::now()")

@old-memories
Copy link
Contributor Author

Thanks for the fix, the build succeeds now!

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