import pytz
from datetime import datetime


def current_seconds_worked(user):
    """Returns the number of seconds worked since clocking in"""
    if not user.profile.clock_in_time:
        return 0
    now = pytz.timezone('America/Los_Angeles').localize(datetime.now())
    time_diff = now - user.profile.clock_in_time
    return time_diff.total_seconds()