from time import time, daylight, altzone, timezone, localtime


def local_time_offset(t=None):
    """Return offset of local system timezone from GMT, either at present or at time t."""
    # python2.3 localtime() can't take None

    if t is None:
        t = time()

    if localtime(t).tm_isdst and daylight:
        return -altzone
    else:
        return -timezone