Commit fe2ce47a authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #1355 from evoskuil/master

Fix error return for clock_gettime.
parents 759c3e31 bc53d710
...@@ -51,8 +51,10 @@ ...@@ -51,8 +51,10 @@
int clock_gettime (int clock_id, timespec *ts) int clock_gettime (int clock_id, timespec *ts)
{ {
// The clock_id specified is not supported on this system. // The clock_id specified is not supported on this system.
if (clock_id != CLOCK_REALTIME) if (clock_id != CLOCK_REALTIME) {
return EINVAL; errno = EINVAL;
return -1;
}
clock_serv_t cclock; clock_serv_t cclock;
mach_timespec_t mts; mach_timespec_t mts;
...@@ -61,6 +63,7 @@ int clock_gettime (int clock_id, timespec *ts) ...@@ -61,6 +63,7 @@ int clock_gettime (int clock_id, timespec *ts)
mach_port_deallocate (mach_task_self (), cclock); mach_port_deallocate (mach_task_self (), cclock);
ts->tv_sec = mts.tv_sec; ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec; ts->tv_nsec = mts.tv_nsec;
return 0;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment