Mercurial > hg > octave-lojdl
changeset 4415:ed8c4aaa8648
[project @ 2003-05-16 21:20:33 by jwe]
author | jwe |
---|---|
date | Fri, 16 May 2003 21:20:33 +0000 |
parents | f071adceaa04 |
children | de2bc66c709f |
files | liboctave/ChangeLog liboctave/oct-rand.cc |
diffstat | 2 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2003-05-16 Paul Kienzle <pkienzle@users.sf.net> + + * oct-rand.cc: Use liboctave's clock layer instead of the system clock. + 2003-05-14 John W. Eaton <jwe@bevo.che.wisc.edu> * Makefile.in: Handle DESTDIR.
--- a/liboctave/oct-rand.cc +++ b/liboctave/oct-rand.cc @@ -27,6 +27,7 @@ #include "f77-fcn.h" #include "lo-error.h" #include "oct-rand.h" +#include "oct-time.h" // Possible distributions of random numbers. This was handled with an // enum, but unwind_protecting that doesn't work so well. @@ -79,17 +80,13 @@ static void do_initialization (void) { - time_t now; - struct tm *tm; - - time (&now); - tm = localtime (&now); + octave_localtime tm; - int hour = tm->tm_hour + 1; - int minute = tm->tm_min + 1; - int second = tm->tm_sec + 1; + int hour = tm.hour() + 1; + int minute = tm.min() + 1; + int second = tm.sec() + 1; - int s0 = tm->tm_mday * hour * minute * second; + int s0 = tm.mday() * hour * minute * second; int s1 = hour * minute * second; s0 = force_to_fit_range (s0, 1, 2147483563);