Re: CODE: time computation is limited

From: George Greer (greerga@circlemud.org)
Date: 11/30/00


On Fri, 1 Dec 2000, Janvier D. Anonical wrote:

>The date computation seems limited to the length of the data type. In the
>code mud_time_passed() under utility.c, the data type of secs is long.
>Since this is the case, when secs exceeds the data type range, an
>overflow will occur thus limiting the date to a certain value (in my
>case, when I tested it, I got only to year 776 so that mud_time_passed()
>can give me a correct value).

act.informative.c: do_time() (and others)

  sprintf(buf, "The %d%s Day of the %s, Year %d.\r\n",
        day, suf, month_name[(int) time_info.month],
        time_info.year);

to:

  sprintf(buf, "The %d%s Day of the %s, Year %d.\r\n",
        day, suf, month_name[(int) time_info.month],
        time_info.year + OFFSET);

>Is there any way to fix this?

Unless you really need the range, just do the above.  Otherwise easiest
would probably be changing it to a 'long long' type.  You could also adjust
your minutes/hour, hours/day, etc.

--
George Greer            | If it's about the CircleMUD mailing list,
greerga@circlemud.org   | mail owner-circle@post.queensu.ca instead.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT