Permalink
Browse files

Swap time(2) with gettimeofday(2), since the latter is optimized away…

… on some platforms. (Brian Aker) <brian@tangent.org>

git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@704 b0b603af-a30f-0410-a34e-baf09ae79d0b
  • Loading branch information...
1 parent ccef546 commit f4ff694161c74ee01b210037ecc9282610e11ccf dormando committed Feb 18, 2008
Showing with 4 additions and 1 deletion.
  1. +4 −1 memcached.c
View
@@ -2565,7 +2565,10 @@ static struct event clockevent;
/* time-sensitive callers can call it by hand with this, outside the normal ever-1-second timer */
static void set_current_time(void) {
- current_time = (rel_time_t) (time(0) - stats.started);
+ struct timeval timer;
+
+ gettimeofday(&timer, NULL);
+ current_time = (rel_time_t) (timer.tv_sec - stats.started);
}
static void clock_handler(const int fd, const short which, void *arg) {

0 comments on commit f4ff694

Please sign in to comment.