diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-23 18:34:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-23 18:34:19 +0000 |
commit | 9c2700afc5c81f9a9199f6989633d94167f6e68a (patch) | |
tree | f57b19d3ebecf3de738cf5307a739caaa341f97a /src/microhttpd/internal.c | |
parent | 9d0f953af2400c13f8a15f68e625d3d60351dd95 (diff) | |
download | libmicrohttpd-9c2700afc5c81f9a9199f6989633d94167f6e68a.tar.gz libmicrohttpd-9c2700afc5c81f9a9199f6989633d94167f6e68a.zip |
check CLOCK_MONOTONIC is defined
Diffstat (limited to 'src/microhttpd/internal.c')
-rw-r--r-- | src/microhttpd/internal.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c index 52d0979f..ef286b20 100644 --- a/src/microhttpd/internal.c +++ b/src/microhttpd/internal.c | |||
@@ -158,14 +158,19 @@ MHD_http_unescape (void *cls, | |||
158 | return wpos - val; /* = strlen(val) */ | 158 | return wpos - val; /* = strlen(val) */ |
159 | } | 159 | } |
160 | 160 | ||
161 | time_t MHD_monotonic_time(void) | 161 | |
162 | time_t | ||
163 | MHD_monotonic_time (void) | ||
162 | { | 164 | { |
163 | #ifdef HAVE_CLOCK_GETTIME | 165 | #ifdef HAVE_CLOCK_GETTIME |
164 | struct timespec ts; | 166 | #ifdef CLOCK_MONOTONIC |
165 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) | 167 | struct timespec ts; |
166 | return ts.tv_sec; | 168 | |
169 | if (0 == clock_gettime (CLOCK_MONOTONIC, &ts)) | ||
170 | return ts.tv_sec; | ||
171 | #endif | ||
167 | #endif | 172 | #endif |
168 | return time(NULL); | 173 | return time (NULL); |
169 | } | 174 | } |
170 | 175 | ||
171 | /* end of internal.c */ | 176 | /* end of internal.c */ |