svn commit: r311751 - stable/10/libexec/talkd

Xin LI delphij at FreeBSD.org
Mon Jan 9 05:52:31 UTC 2017


Author: delphij
Date: Mon Jan  9 05:52:30 2017
New Revision: 311751
URL: https://svnweb.freebsd.org/changeset/base/311751

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

Modified:
  stable/10/libexec/talkd/table.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/talkd/table.c
==============================================================================
--- stable/10/libexec/talkd/table.c	Mon Jan  9 05:51:38 2017	(r311750)
+++ stable/10/libexec/talkd/table.c	Mon Jan  9 05:52:30 2017	(r311751)
@@ -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 */


More information about the svn-src-all mailing list