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

fix ftime warning #3710

Merged
merged 3 commits into from
Sep 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion consensus/cryptonight-rs/ext/oaes_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
#else
static uint32_t oaes_get_seed(void)
{
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__NetBSD__)
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__NetBSD__) && !defined(__GLIBC__)
struct timeb timer;
struct tm *gmTimer;
char * _test = NULL;
Expand All @@ -518,6 +518,7 @@ static uint32_t oaes_get_seed(void)
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
(uintptr_t) ( _test + timer.millitm ) + GETPID();
#else
#include <sys/time.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://man7.org/linux/man-pages/man3/ftime.3.html 参考这里可以使用time或gettimeofday, C programming include一般写在开头

Copy link
Collaborator Author

@jiangying000 jiangying000 Sep 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把里面的 #include 去掉了,改成文件开始时判断条件 include,在glibc 2.31以上用gettimeofday,其他时候保持原样

struct timeval timer;
struct tm *gmTimer;
char * _test = NULL;
Expand Down