将代码更新为swift 4会导致出现错误消息

2 swift swift4 xcode9

我想将此代码更新为swift 4:

rc = select(socket_fd + 1, readfd, writefd, NULL, &timeout);

return rc;
  }
Run Code Online (Sandbox Code Playgroud)

但我得到两个错误:

必须在模块'Darwin.POSIX.sys.time'中导入'select'
声明才能满足需要C99中函数'select'的隐式声明无效

我怎么能解决这个问题?

aar*_*ron 8

将其添加到文件顶部附近:

#include <sys/time.h>
Run Code Online (Sandbox Code Playgroud)