Vanilla Netrek Server Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[VANILLA-L:404] RE: Confused



On Wednesday, January 22, 1997 4:13 PM, Bob
Tanner[SMTP:tanner@real-time.com] wrote:
>>I am looking in struct.h (don't ask why :) and I see the following
>>declaration.
>>
>>struct status {
>>    int         active;
>>    u_char      tourn;          /* Tournament mode? */
>>    /* These stats only updated during tournament mode */
>>    u_int       armsbomb, planets, kills, losses, time;
>>    /* Use long for this, so it never wraps */
>>    double      timeprod;
>>    int         gameup;
>>};
>>
>>My question is the comment /* Use long for this, so it never wraps */
>>but timeprod is declared double.
>>
>>    /* Use long for this, so it never wraps */
>>    double      timeprod;
>>
>>Which is right? 
>>
>>Under gdb (running updated) I get these values.
>>
>>(gdb) p *status
>>$8 = {active = 1327, tourn = 0 '\000', armsbomb = 2166216, planets = 81630,
>>kills = 861873, losses = 927413, time = 79665240, timeprod = 1000276229,
>>gameup = 1}
>>
>>In another program I am writing I read the value as a double I get:
>>
>>Time Prod 5.45452e-315
>>
>>Which is wrong.
>>
>>If I read it as a long:
>>
>>Time Prod 1104007040	/* close but not  same */
>>Game Up -2105540608	/* REALLY wrong! */
>>
>>Which is also wrong.
>>
>>So, I don't get it. Anyone want to enlighten me?
>>
>>-- 
>>Robert J. Tanner <tanner@real-time.com> | Phone : 612.943.8700
>>http://www.real-time.com                | Fax   : 612.943.8300
>>Key fingerprint =  6C E9 51 4F D5 3E 4C 66  62 A9 10 E5 35 85 39 D9 

This is wierd that the double timeprod conversion which has been in the
server source for a 
while now has caused 2 problems in the same day...

double is correct now. It used to be a long but that overflowed on
long-running servers like
wormhole and calvin. So, I put in the calvin patches to make it a
double.

So, unless you've just upgraded your server from a pretty old source
(which still had timeprod
being a long) this shouldn't be causing a problem.

When you upgrade your server make sure you do a make install so that all
the new executables 
which rely on timeprod are updated and more importantly so that the
conversion program is
run. This program which is part of make install converts the old long
timeprod to a double
for you.

Which server were/are you using?

Nick
----------------------------------------------------------------
"There is nothing we won't say to convince people that the 
  Microsoft way is the way to go" -- Bill Gates.
These are my views and are not to be construed as the views of Landacorp
Nick Trown. Software Engineer, Strategic Development Group, Landacorp