import time


def convert_to_local(curr_time):
    """ Take a time stamp input and convert to seconds since midnight """

    midnight = list(time.localtime(curr_time))
    # Set hour, minute, sec to 0
    midnight[3] = 0
    midnight[4] = 0
    midnight[5] = 0

    midnight_sec = time.mktime(time.struct_time(midnight))

    return curr_time - midnight_sec