Skip to content

Error upon build in function clock_gettime() #199

@XInTheDark

Description

@XInTheDark

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions