Re: Time in prompts -

From: Daniel A. Koepke (
Date: 11/07/01

On Wed, 7 Nov 2001, Ben Merton wrote:

> A rather silly question, im gonna feel so stupid when i get the
> answer, but.. - I'm trying to find out what command will grab mudtime
> in the code...

The mudtime information is stored in the time_info variable:

  extern struct time_info_data time_info;

It really depends upon how much information you want to print out.  The
following writes just the mudtime (e.g., "12pm") to the buffer buf:

  sprintf(buf, "%d%s",
          ((time_info.hours % 12) == 0 ? 12 : (time_info.hours % 12)),
          (time_info.hours >= 12 ? "pm" : "am"));

Integrating this with the prompt code in make_prompt() is up to you, but
fairly simple.  I don't know if this is very useful information to display
to someone repeatedly.  They can type 'time' if they want it, right?

> Also is it possible to grab the person's machine time who is
> connected??

No.  They would have to send it to you and there's no way to force them to
do that.  I don't really understand why displaying this type of
information would be beneficial.  I have clocks all around me when I'm
sitting down at the computer and most users will have a clock displayed on
their screen already.  Information overload is dangerous.


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST