Re: Timediff Problem

From: StormeRider (silk@ICI.NET)
Date: 01/01/98


Was taking a look at what timediff does as well, and it seems that it's an
essential element of the base processing. Fun fun fun. Computes sleep times
and other nice stuff or something to that effect. Buried neatly in comm.c.
Well, decided to look around more and print out what

>GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation,
Inc...
>Core was generated by `bin/circle -q 4005'.
>Program terminated with signal 11, Segmentation fault.
>Reading symbols from /lib/libc.so.5.4.33...done.
>Reading symbols from /lib/ld-linux.so.1...done.
>#0  0x804a75b in timediff (a={tv_sec = -1073744400, tv_usec = 7}, b={
>      tv_sec = 46693, tv_usec = 46693}) at comm.c:910
>910           return null_time;

null_time was ---

(gdb) print null_time
$1 = {tv_sec = 0, tv_usec = 0}

Returning a struct of {0,0} crashes. Great. =) Especially when the timediff
comment says:

/*
 *  new code to calculate time differences, which works on systems
 *  for which tv_usec is unsigned (and thus comparisons for something
 *  being < 0 fail).  Based on code submitted by ss@sirocco.cup.hp.com.
 */

/*
 * code to return the time difference between a and b (a-b).
 * always returns a nonnegative value (floors at 0).
 */

If the floor is at 0, then why does it want to crash??? *grin* Going to go
take
a look at the timediffs from stock pl11 and pl12 and see if they differ at
all...


StormeRider                  --- http://www.windsofstorm.net/wos/
silk@ici.net                 --- telnet://cmoo.com:4004


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST