Re: function for clockticks since 1980?
- From: nsa.usa@xxxxxxxxx
- Date: Sat, 28 Jul 2007 18:16:20 -0700
On Jul 29, 2:58 am, Ben Bacarisse <ben.use...@xxxxxxxxx> wrote:
#include <time.h>
time_t time(time_t *timer);
The time function determines the current calendar time. The
encoding of the value is unspecified.
so you can't rely on much variability there (it *may* be fine, but the
solution would not be portable).
Yeah, this one seems to be down to the second only, and so when the
app is run 100 times (or even just 2 times) within the same second,
then I got a prob =:-)
Since there is not ideal portable solution, your best bet may well be
to accept that go fully platform dependent. A small 'get_random_seed'
function will be a couple of lines long and can be written easily for
(reasonable) platform on which a web application might run. Post in a
newsgroup for your which every platform you are currently using for
ideas about getting a good random seed.
--
Ben.
I might try the /dev/random for linux platform as was suggested by Xu
earlier. Just worried about the overhead on that one though. App is
only planned to run on linux on i32 or platform, so I only need it to
work on this (for now..). Im pretty sure there is an interrupt to give
this amount of milliseconds since 1980 on that cpu, but then again I'd
hate to stick in cpu specific stuff..
Somehow I thought this function would be standard in C (I'm not so
used to C)... oh well :-)
Thanks.
Tobias
.
- Follow-Ups:
- Re: function for clockticks since 1980?
- From: Peter J. Holzer
- Re: function for clockticks since 1980?
- From: Ben Bacarisse
- Re: function for clockticks since 1980?
- References:
- function for clockticks since 1980?
- From: nsa . usa
- Re: function for clockticks since 1980?
- From: Ben Bacarisse
- function for clockticks since 1980?
- Prev by Date: Re: The chart of comp.lang.c
- Next by Date: Re: function for clockticks since 1980?
- Previous by thread: Re: function for clockticks since 1980?
- Next by thread: Re: function for clockticks since 1980?
- Index(es):
Relevant Pages
|