comparison 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
comparison
equal deleted inserted replaced
116:0a12fc56db30 117:d45b0abe7c79
1 /* 1 /*
2 protocol.c 2 protocol.c
3 3
4 $Id: protocol.c 155 2000-06-24 20:28:01Z bears $ 4 $Id: protocol.c 165 2000-06-25 18:42:10Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
274 void 274 void
275 Prt_genMsgId( Str msgId, const char *from, const char *suffix ) 275 Prt_genMsgId( Str msgId, const char *from, const char *suffix )
276 { 276 {
277 Str domain, date; 277 Str domain, date;
278 time_t t; 278 time_t t;
279 279 static Bool randSeeded = FALSE;
280
281 if ( ! randSeeded )
282 {
283 struct timeval tv;
284 struct timezone tz;
285
286 if ( gettimeofday( &tv, &tz ) == 0 )
287 srand( (unsigned int) tv.tv_usec );
288 randSeeded = TRUE;
289 }
280 getDomain( domain, from ); 290 getDomain( domain, from );
281 time( &t ); 291 time( &t );
282 strftime( date, MAXCHAR, "%Y%m%d%H%M%S", gmtime( &t ) ); 292 strftime( date, MAXCHAR, "%Y%m%d%H%M%S", gmtime( &t ) );
283 srand( (unsigned int)time( NULL ) );
284 snprintf( msgId, MAXCHAR, "<%s.%X.%s@%s>", date, rand(), suffix, domain ); 293 snprintf( msgId, MAXCHAR, "<%s.%X.%s@%s>", date, rand(), suffix, domain );
285 ASSERT( Prt_isValidMsgId( msgId ) ); 294 ASSERT( Prt_isValidMsgId( msgId ) );
286 } 295 }
287 296
288 void 297 void