Try this (untested) code:

Code:

on *:CONNECT:*:{
  if ($hget(jt.,$cid)) hfree $+(jt.,$cid)
  hmake $+(jt.,$cid) 10
}

on *:JOIN:*:{
  hadd -m $+(jt.,$cid) $+($nick,.,$chan) $ctime
  if ($nick == $me) {
    var %c = 1, %cc = $nick($chan,0)
    while (%c < %cc) {
      hadd -m $+(jt.,$cid) $+($nick($chan,%c),.,$chan) $ctime
      inc %c
    }
  }
}

on *:PART:*:{
  hdel $+(jt.,$cid) $+($nick,.,$chan)
  if ($nick == $me) hdel -w $+(jt.,$cid) $+(*.,$chan)
}

on *:KICK:*:{
  hdel $+(jt.,$cid) $+($nick,.,$chan)
  if ($nick == $me) hdel -w $+(jt.,$cid) $+(*.,$chan)
}

on *:QUIT:{
  hdel -w $+(jt.,$cid) $+($nick,.*)
  if (($nick == $me) && ($hget($+(jt.,$cid)))) hfree $+(jt.,$cid)
}

on *:DISCONNECT:{
  if ($hget($+(jt.,$cid))) hfree $+(jt.,$cid)
}


on *:NICK:{
  var %c = 1, %cc = $hfind($+(jt.,$cid),$+($nick,.*),0,w)
  while (%c < %cc) {
    var %chan = $gettok($hfind($+(jt.,$cid),$+($nick,.*),%c,w),2,46)
    hadd $+(jt.,$cid) $+($newnick,.,%chan) $hget($+(jt.,$cid),$+($nick,.,%chan))
  }
  hdel -w $+(jt.,$cid) $+($nick,.*)
}

alias jointime {
  if ($2 == $null) return
  var %cid = $cid
  if ($3 != $null) %cid = $3
  if ($isid) return $hget($+(jt.,%cid),$+($1,.,$2))
  echo -a $hget($+(jt.,%cid),$+($1,.,$2)
}



Automatically keeps track of all nicks on all channels on all networks. Multi-network safe (uses $cid). When you join a channel, all other users on the channel get the same join time as you. To retrieve data:

/jointime <nick> <channel> [cid]

//echo -a $jointime(<nick>,<channel>,[cid])

The alias only returns the $ctime when the user joined the specified channel. You can perform whatever calculations you want using the $jointime() returned value. Returns/displays $null for invalid/nonexistant nick and channel.

Report any bugs.

-genius_at_work