Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Dec 2016 17:23:09 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310609 - head/libexec/talkd
Message-ID:  <201612261723.uBQHN9WI017440@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Dec 26 17:23:09 2016
New Revision: 310609
URL: https://svnweb.freebsd.org/changeset/base/310609

Log:
  Don't use high precision clock for expiration as only second portion is
  used.
  
  MFC after:	2 weeks

Modified:
  head/libexec/talkd/table.c

Modified: head/libexec/talkd/table.c
==============================================================================
--- head/libexec/talkd/table.c	Mon Dec 26 17:10:41 2016	(r310608)
+++ head/libexec/talkd/table.c	Mon Dec 26 17:23:09 2016	(r310609)
@@ -60,7 +60,7 @@ static const char rcsid[] =
 
 #define NIL ((TABLE_ENTRY *)0)
 
-static struct timeval tp;
+static struct timespec ts;
 
 typedef struct table_entry TABLE_ENTRY;
 
@@ -85,8 +85,8 @@ find_match(CTL_MSG *request)
 	TABLE_ENTRY *ptr, *next;
 	time_t current_time;
 
-	gettimeofday(&tp, NULL);
-	current_time = tp.tv_sec;
+	clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+	current_time = ts.tv_sec;
 	if (debug)
 		print_request("find_match", request);
 	for (ptr = table; ptr != NIL; ptr = next) {
@@ -119,8 +119,8 @@ find_request(CTL_MSG *request)
 	TABLE_ENTRY *ptr, *next;
 	time_t current_time;
 
-	gettimeofday(&tp, NULL);
-	current_time = tp.tv_sec;
+	clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+	current_time = ts.tv_sec;
 	/*
 	 * See if this is a repeated message, and check for
 	 * out of date entries in the table while we are it.
@@ -157,8 +157,8 @@ insert_table(CTL_MSG *request, CTL_RESPO
 	TABLE_ENTRY *ptr;
 	time_t current_time;
 
-	gettimeofday(&tp, NULL);
-	current_time = tp.tv_sec;
+	clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+	current_time = ts.tv_sec;
 	request->id_num = new_id();
 	response->id_num = htonl(request->id_num);
 	/* insert a new entry into the top of the list */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612261723.uBQHN9WI017440>