From 2816f3ceaa31452f6bb67a7a7297e6795221cb35 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 24 Dec 2010 15:41:53 -0800 Subject: use clock_gettime for time resolution This lets us use CLOCK_MONOTONIC so we are not affected by system clock changes. We still convert to microseconds instead of nanoseconds for (pure)-Ruby 1.8 code compatibility. There is also little need for nanosecond timer resolution in log files (microsecond is not needed, even). --- ext/clogger_ext/extconf.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ext/clogger_ext/extconf.rb') diff --git a/ext/clogger_ext/extconf.rb b/ext/clogger_ext/extconf.rb index b327ada..60c46a7 100644 --- a/ext/clogger_ext/extconf.rb +++ b/ext/clogger_ext/extconf.rb @@ -13,6 +13,10 @@ begin have_macro('O_NONBLOCK', %w(unistd.h fcntl.h)) end + unless have_macro('CLOCK_MONOTONIC', 'time.h', '-D_POSIX_C_SOURCE=200112L') + $CPPFLAGS += '-D_POSIX_SOURCE_200112L' + have_func('CLOCK_MONOTONIC', 'time.h') + end have_func('localtime_r', 'time.h') or raise "localtime_r needed" have_func('gmtime_r', 'time.h') or raise "gmtime_r needed" have_func('rb_str_set_len', 'ruby.h') -- cgit v1.2.3-24-ge0c7