diff src/protocol.c @ 117:d45b0abe7c79 noffle

[svn] Merge with release-1-0 at release-1-0-merge-3
author bears
date Sun, 25 Jun 2000 19:42:10 +0100
parents 6f681d41734c
children 3c71e28c8eef
line wrap: on
line diff
--- a/src/protocol.c	Sat Jun 24 21:52:33 2000 +0100
+++ b/src/protocol.c	Sun Jun 25 19:42:10 2000 +0100
@@ -1,7 +1,7 @@
 /*
   protocol.c
 
-  $Id: protocol.c 155 2000-06-24 20:28:01Z bears $
+  $Id: protocol.c 165 2000-06-25 18:42:10Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -276,11 +276,20 @@
 {
     Str domain, date;
     time_t t;
+    static Bool randSeeded = FALSE;
 
+    if ( ! randSeeded )
+    {
+	struct timeval tv;
+	struct timezone tz;
+
+	if ( gettimeofday( &tv, &tz ) == 0 )
+	    srand( (unsigned int) tv.tv_usec );
+	randSeeded = TRUE;
+    }
     getDomain( domain, from );
     time( &t );
     strftime( date, MAXCHAR, "%Y%m%d%H%M%S", gmtime( &t ) );
-    srand( (unsigned int)time( NULL ) );
     snprintf( msgId, MAXCHAR, "<%s.%X.%s@%s>", date, rand(), suffix, domain );
     ASSERT( Prt_isValidMsgId( msgId ) );
 }