diff liboctave/oct-rand.cc @ 4415:ed8c4aaa8648

[project @ 2003-05-16 21:20:33 by jwe]
author jwe
date Fri, 16 May 2003 21:20:33 +0000
parents b738d1a02adb
children 79df15d4470c
line wrap: on
line diff
--- a/liboctave/oct-rand.cc	Fri May 16 20:11:35 2003 +0000
+++ b/liboctave/oct-rand.cc	Fri May 16 21:20:33 2003 +0000
@@ -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);