On Tue, Jul 02, 2002 at 06:12:41PM -0400, Michael Weiss wrote:
> Is there any way to calculate elapsed time? I am trying to write a
> function to see how long has passed since a player has logged in. I
> currently have 'finger' so I can see the time stamp of their last logoff.
> I wanted to find a way to subtract that from the current system time to use
> in a comparision check.... ie... see if its been more than 30 or 60 days
> since a player logged in. I need to do this on a player by player basis
> as part of a roster function.
>
> Any guidance would be greatly appreciated.
Sure: time_t's can be subtracted.
if ( (current_time - last_on) > 30 * 24 * 60 * 60 )
{
send_to_char(ch, "hey, it's more than 30 days!!");
}