Well, you had some mistakes such as not closing off the echo '';, not putting code in the if statement that should be, and more of a personal preference which is indenting. Make sure to indent every new layer of element so that it is easier to look at your code to see what is wrong with it.
Your main issue was that you had the <div class="floatleft"> outside of the if statement echo and not closing off the echo for the if statement and starting a new one.
You can leave out the brackets but I like to put them in for readability. Just make sure if you are going to leave out the brackets that you make a echo for the if and then another echo for the other content.
For ex.
if($happy)
echo '
yay';
echo'
other content';
echo '
<div class="top_bar">
<div class="top_bar_inner" style="width: ', !empty($settings['forum_width']) ? $settings['forum_width'] : '' ,'">
<div class="top_bar_guts">
';
if ($context['user']['is_logged'])
{
echo '
<div class="floatleft">
<span>
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a>
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>
</span>
</div>';
}
echo '
<div class="floatright">
<span>', $context['current_time'], '</span>
</div>
</div>
</div>
</div>
';