I assume you first read the help file to figure out exactly what $online returns. In case you didn't:
$online
Returns the number of seconds elapsed in the Timer dialog.
It does not return your current connection's duration. It returns the
cumulative duration for all connections since the timer dialog was last reset. For reference, mine is currently at 17823hrs 29mins 10seconds. No, my IRC connection is not 106 weeks old. This is a cumulative value until I manually reset it.
If you want connection time for your CURRENT connection use $uptime(server,1)