Newsgroups: comp.os.msdos.programmer,comp.os.msdos.djgpp From: manni DOT heumann AT gmx DOT de (Manni Heumann) Subject: Re: Uptime and entropy in DOS Distribution: world References: <38A5583C DOT EDF375B4 AT is DOT elta DOT co DOT il> <591baskf2ns6u0n0l6kp8rgml7aa2q80la AT 4ax DOT com> X-Newsreader: News Xpress 2.01 Date: Sat, 12 Feb 2000 18:13:37 GMT NNTP-Posting-Host: ppp36-200.hrz.uni-bielefeld.de Message-ID: <38a5a2da_1@news.uni-bielefeld.de> X-Trace: 12 Feb 2000 19:13:46 +0200, ppp36-200.hrz.uni-bielefeld.de Lines: 30 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <591baskf2ns6u0n0l6kp8rgml7aa2q80la AT 4ax DOT com>, REPLYTOd_yerrick AT hotmail DOT comNO2CANNEDHAM wrote: >On Sat, 12 Feb 2000 14:55:24 +0200, Eli Zaretskii >wrote: > >>Damian Yerrick wrote: >>> >>> Is it possible to get the uptime of a DOS system? I need more entropy >>> than the 32 bits I get from time(NULL) to initialize a pseudorandom >>> number generator. >> >>Did you try `uclock' or `gettiomeofday'? It's in the FAQ (section 22.23). > >uclock() won't work because it measures uptime of the current process, >which is *known* when the process starts, which is when I seed my PRNG >and start Allegro. And because Allegro reprograms the timer, I can't >reseed from uclock() after the program starts. > >gettimeofday() won't work because it in theory can be calculated from >time(NULL), which I'm already using, and adds no entropy. > I'm nosy: Why isn't all of this enough for you? What about the user? How about a "Any key to continue" message and you measure the time it takes to answer that one and then combine it with time (NULL). -- Manni