You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "William A. Rowe, Jr." <wr...@covalent.net> on 2002/02/12 02:34:14 UTC

Re: cvs commit: apr/file_io/unix mktemp.c

A question for the list - are we really working in microsecond resolutions?
(Win32 is to the nearest 10 microseconds, I'm guessing others aren't that
precise.)  If so, what would you choose as a divisor, since we could certainly
pick a better divisor than USEC_PER_SEC for randomness.

> wrowe       02/02/11 17:27:09
> 
>   Modified:    file_io/unix mktemp.c
>   Log:
>     I hope the clocks have sufficient resolution to make this randomization
>     useful.  Comments?  We may need to divide, not necessarily by USEC_PER_SEC
>     but perhaps by a nice binary value.
>   
>   Submitted by: Mladen Turk <mt...@mappingsoft.com>
>   
>   Revision  Changes    Path
>   1.21      +7 -1      apr/file_io/unix/mktemp.c
>   
>   --- mktemp.c 18 Jan 2002 19:16:29 -0000 1.20
>   +++ mktemp.c 12 Feb 2002 01:27:09 -0000 1.21
>   @@ -130,7 +136,7 @@
>        apr_uint32_t randnum;
>    
>        if (randseed==0) {
>   -        randseed = time(NULL);
>   +        randseed = (int)apr_time_now();
>            seedrandom(randseed);
>        }
>    
>   
>   
>   
> 


Re: cvs commit: apr/file_io/unix mktemp.c

Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
++1, would you care to make it so :-?

----- Original Message ----- 
From: "Aaron Bannert" <aa...@clove.org>
To: "William A. Rowe, Jr." <wr...@covalent.net>
Cc: <de...@apr.apache.org>
Sent: Monday, February 11, 2002 7:44 PM
Subject: Re: cvs commit: apr/file_io/unix mktemp.c


> On Mon, Feb 11, 2002 at 07:34:14PM -0600, William Rowe wrote:
> > A question for the list - are we really working in microsecond resolutions?
> > (Win32 is to the nearest 10 microseconds, I'm guessing others aren't that
> > precise.)  If so, what would you choose as a divisor, since we could certainly
> > pick a better divisor than USEC_PER_SEC for randomness.
> 
> How about XOR-ing the lower and upper 32 bits?
> 
> -aaron
> 


Re: cvs commit: apr/file_io/unix mktemp.c

Posted by Aaron Bannert <aa...@clove.org>.
On Mon, Feb 11, 2002 at 07:34:14PM -0600, William Rowe wrote:
> A question for the list - are we really working in microsecond resolutions?
> (Win32 is to the nearest 10 microseconds, I'm guessing others aren't that
> precise.)  If so, what would you choose as a divisor, since we could certainly
> pick a better divisor than USEC_PER_SEC for randomness.

How about XOR-ing the lower and upper 32 bits?

-aaron