-/* $NetBSD: schedule.c,v 1.8 2009/05/24 19:18:44 dholland Exp $ */
+/* $NetBSD: schedule.c,v 1.11 2009/05/24 22:55:03 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)schedule.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: schedule.c,v 1.8 2009/05/24 19:18:44 dholland Exp $");
+__RCSID("$NetBSD: schedule.c,v 1.11 2009/05/24 22:55:03 dholland Exp $");
#endif
#endif /* not lint */
double date;
date = Now.date + offset;
- for (i = 0; i < MAXEVENTS; i++)
- {
+ for (i = 0; i < MAXEVENTS; i++) {
e = &Event[i];
if (e->evcode)
continue;
/* got a slot */
-# ifdef xTRACE
+#ifdef xTRACE
if (Trace)
- printf("schedule: type %d @ %.2f slot %d parm %d %d %d\n",
+ printf("schedule: type %d @ %.2f "
+ "slot %d parm %d %d %d\n",
type, date, i, x, y, z);
-# endif
+#endif
e->evcode = type;
e->date = date;
e->x = x;
date = Now.date + offset;
e->date = date;
-# ifdef xTRACE
+#ifdef xTRACE
if (Trace)
printf("reschedule: type %d parm %d %d %d @ %.2f\n",
e->evcode, e->x, e->y, e->systemname, date);
-# endif
+#endif
return;
}
e = e1;
-# ifdef xTRACE
+#ifdef xTRACE
if (Trace)
printf("unschedule: type %d @ %.2f parm %d %d %d\n",
e->evcode, e->date, e->x, e->y, e->systemname);
-# endif
+#endif
Now.eventptr[e->evcode & E_EVENT] = 0;
e->date = TOOLARGE;
e->evcode = 0;
xsched(int ev1, int factor, int x, int y, int z)
{
int ev;
+ double when;
ev = ev1;
- return (schedule(ev, -Param.eventdly[ev] * Param.time * log(franf()) / factor, x, y, z));
+ when = -Param.eventdly[ev] * Param.time * log(franf()) / factor;
+ return (schedule(ev, when, x, y, z));
}
{
int ev;
struct event *e;
+ double when;
ev = ev1;
e = e1;
- reschedule(e, -Param.eventdly[ev] * Param.time * log(franf()) / factor);
+ when = -Param.eventdly[ev] * Param.time * log(franf()) / factor;
+ reschedule(e, when);
}