Update the use of clock_gettime(2)
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 8 Apr 2015 20:03:02 +0000 (13:03 -0700)
committerErich Keane <erich.keane@intel.com>
Thu, 9 Apr 2015 19:47:30 +0000 (19:47 +0000)
commitf4c4d1ef3f946f2f5f435a37c045d6cb17a7e1f0
tree7750b934b2c4ac6929cc08848d004e442e23cbe2
parent13caee29ac64f3ff24dbf4908e737ec7bcafb53a
Update the use of clock_gettime(2)

clock_gettime(2) is a POSIX feature, but CLOCK_REALTIME_COARSE is a
Linux extension. So instead of using clock_gettime only on Linux, try to
use the POSIX macros instead. This way, we'll use clock_gettime on
systems that support it, falling back to gettimeofday if they don't.

POSIX.1-2008 requires clock_gettime(2) functionality, so up the
_POSIX_C_SOURCE macro requirement to the 2008 version. This will request
the 2008 API if it's available on some systems (QNX is known to not
enable all the API it has available). Older versions of POSIX don't
require the timer support.

Change-Id: I27eaacb532114dd188c4ffff13d3229d285d21cb
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/677
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Charlie Lenahan <charlie.lenahan@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/common/src/logger.c
resource/csdk/logger/src/logger.c