Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#8429) timeout setting
Home

[Freeciv-Dev] Re: (PR#8429) timeout setting

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: richih@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8429) timeout setting
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Mon, 5 Apr 2004 08:35:08 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8429 >


> I think you make this bigger than it is. How many complains did we got
> "I set timeout to -1 and than it didn't work anymore".

Just 1, so far.

> The current
> text reads:
>
>   If all players have not hit "Turn Done" before this time is up, then the
>   turn ends automatically. Zero means there is no timeout. In DEBUG
> servers, a
>   timeout of -1 sets the autogame test mode. Use this with the command
>   "timeoutincrease" to have a dynamic timer.
>
> A "test mode" is quite clearly not something like "production mode".

But it's enabled on production-mode servers!  The helptext is wrong!

>> >> - Timeouts are measured with 1-second accuracy only.  Surely we
>> should
>> >> use the timer code for this...
>> >
>> > You want timeouts which fractions of a second? And why?
>>
>> No, I don't want a 0.1 second timeout.  I want a 4-second timeout to
>> mean
>> 4 seconds, not sometimes 3.2 and sometimes 4.9.
>
> Can you explain in more detail what is causing this?

Currently time() is used for the timeout.  This has a 1-second resolution.
 So say we have a 4-second timeout.

- A particular turn starts at time 3.8.  time(NULL) => 3, so the turn ends
at time 7.  At time 7.0 a packet is received and handled.  Now the turn
ends.  It was 3.2 seconds long.

- A particular turn starts at time 7.0.  time(NULL) => 7, so the turn ends
at time 11.  A few packets are handled at the start of the turn, putting
us at time 7.9 (time() => 7 still).  Now a select() is called and told to
wait for 4 seconds.  No packets are received and the select ends at 11.9. 
The turn ends.  It was 4.9 seconds long.

This is simplified because I've ignored command-line (stdin) input.  But
the concept is the same.  There is only a 1-second accuracy to turn length
measurements.  This is not a big problem, but it is easily fixable by
using the timer code.

jason




[Prev in Thread] Current Thread [Next in Thread]