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

Error upon build in function clock_gettime() #199

Open
XInTheDark opened this issue Jun 5, 2023 · 1 comment
Open

Error upon build in function clock_gettime() #199

XInTheDark opened this issue Jun 5, 2023 · 1 comment

Comments

@XInTheDark
Copy link

XInTheDark commented Jun 5, 2023

Environment: macOS 13.1, g++ 12.2.0

Commands:

sh build-mini.sh
./build/4ku-mini

Error message:

<stdin>: In function 'int64_t a()':
<stdin>:11:82: error: invalid conversion from 'int' to 'clockid_t' [-fpermissive]
In file included from /opt/homebrew/Cellar/gcc/12.2.0/include/c++/12/ctime:42,
                 from <stdin>:5:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/time.h:178:29: note:   initializing argument 1 of 'int clock_gettime(clockid_t, timespec*)'
  178 | int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
      |                   ~~~~~~~~~~^~~~~~~~~~
./build/4ku-mini: line 5: /var/folders/5m/v_lfr66s1mg7l9qhv3mjfkfc0000gn/T/tmp.4DH2RQex: Undefined error: 0

Cause of error occurs in src/main-mini.cpp, line 11:

using namespace std;int b=1<<15;int c=1<<16;int64_t a(){timespec d;clock_gettime(6,&d);return d.tv_sec*1000+d.tv_nsec/1000000;}

In turn this is caused by main.cpp line 52:

clock_gettime(CLOCK_MONOTONIC, &t);
@kz04px
Copy link
Owner

kz04px commented Jun 5, 2023

I'll try to avoid this with alternate timing code that won't add bytes, but I don't have high hopes.

Thanks for opening an issue.

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