Modify the code of recent comments wordpress?

There is a simple code of the last review. Please tell me how to do the following here:
1. Display relative date by type 10 minutes ago, 5 days ago.
2. Display a link to the profile of the author of the comment if it was on the website. If the user does not zaregan on the website, then the link does not display only the name.

site_recent_comments function() {
 $comment_len = 80;
 $comments = get_comments('number=5');
 if ($comments) {
 foreach ($comments as $comment) {
?>
the <li>
 <?php echo get_avatar($comment,$size='40' ); ?>
 <?php echo $comment--->comment_author; ?>
<?php
 $d = "d M Y, H:i";
 $comment_ID = $comment--->comment_ID;
 $comment_date = get_comment_date( $d, $comment_ID );
 echo $comment_date;
?>

 <?php echo mb_substr( strip_tags( $comment--->comment_content ), 0, 50 ); ?>...
 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php
}
 } else {
 echo "<li-->no Comment";
}
}
June 5th 19 at 21:41

Find more questions by tags WordPress