from datetime import datetime
import time


def uptime(since):
    """Turn an date and time into an uptime value.

    The returned value is a number of seconds from the provided value
    to the current time. The date/time provided is expected to be a
    local time using the following format: 2017-01-10 16:32:21.

    """
    fr = datetime(*time.strptime(since, "%Y-%m-%d %H:%M:%S")[:6])
    to = datetime.now()
    delta = to - fr
    delta = int(delta.total_seconds())
    if delta < 0:
        return 0
    return delta