talkd(8): use NULL for second gettimeofday(2) argument

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

talkd(8): use NULL for second gettimeofday(2) argument

Scott Cheloha
The timezone has no utility in this code.

ok to use NULL?

Index: table.c
===================================================================
RCS file: /cvs/src/libexec/talkd/table.c,v
retrieving revision 1.19
diff -u -p -r1.19 table.c
--- table.c 26 Aug 2016 08:44:04 -0000 1.19
+++ table.c 9 Aug 2019 21:28:02 -0000
@@ -52,7 +52,6 @@
 #define MAX_ID 16000 /* << 2^15 so I don't have sign troubles */
 
 struct timeval tp;
-struct timezone txp;
 
 typedef struct table_entry TABLE_ENTRY;
 
@@ -84,7 +83,7 @@ find_match(CTL_MSG *request)
  TABLE_ENTRY *ptr, *next;
  time_t current_time;
 
- gettimeofday(&tp, &txp);
+ gettimeofday(&tp, NULL);
  current_time = tp.tv_sec;
  if (debug)
  print_request("find_match", request);
@@ -121,7 +120,7 @@ find_request(CTL_MSG *request)
  TABLE_ENTRY *ptr, *next;
  time_t current_time;
 
- gettimeofday(&tp, &txp);
+ gettimeofday(&tp, NULL);
  current_time = tp.tv_sec;
  /*
  * See if this is a repeated message, and check for
@@ -161,7 +160,7 @@ insert_table(CTL_MSG *request, CTL_RESPO
 
  if (debug)
  print_request( "insert_table", request );
- gettimeofday(&tp, &txp);
+ gettimeofday(&tp, NULL);
  current_time = tp.tv_sec;
  request->id_num = new_id();
  response->id_num = htonl(request->id_num);

Reply | Threaded
Open this post in threaded view
|

Re: talkd(8): use NULL for second gettimeofday(2) argument

Mark Kettenis
> Date: Fri, 9 Aug 2019 16:28:47 -0500
> From: Scott Cheloha <[hidden email]>
>
> The timezone has no utility in this code.
>
> ok to use NULL?

ok kettenis@

> Index: table.c
> ===================================================================
> RCS file: /cvs/src/libexec/talkd/table.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 table.c
> --- table.c 26 Aug 2016 08:44:04 -0000 1.19
> +++ table.c 9 Aug 2019 21:28:02 -0000
> @@ -52,7 +52,6 @@
>  #define MAX_ID 16000 /* << 2^15 so I don't have sign troubles */
>  
>  struct timeval tp;
> -struct timezone txp;
>  
>  typedef struct table_entry TABLE_ENTRY;
>  
> @@ -84,7 +83,7 @@ find_match(CTL_MSG *request)
>   TABLE_ENTRY *ptr, *next;
>   time_t current_time;
>  
> - gettimeofday(&tp, &txp);
> + gettimeofday(&tp, NULL);
>   current_time = tp.tv_sec;
>   if (debug)
>   print_request("find_match", request);
> @@ -121,7 +120,7 @@ find_request(CTL_MSG *request)
>   TABLE_ENTRY *ptr, *next;
>   time_t current_time;
>  
> - gettimeofday(&tp, &txp);
> + gettimeofday(&tp, NULL);
>   current_time = tp.tv_sec;
>   /*
>   * See if this is a repeated message, and check for
> @@ -161,7 +160,7 @@ insert_table(CTL_MSG *request, CTL_RESPO
>  
>   if (debug)
>   print_request( "insert_table", request );
> - gettimeofday(&tp, &txp);
> + gettimeofday(&tp, NULL);
>   current_time = tp.tv_sec;
>   request->id_num = new_id();
>   response->id_num = htonl(request->id_num);
>
>