import struct


def encode_time(t):
    """
    Converts date to specific codification of time used in ZKTeco
    get/set time procedures.

    :param t: Datetime object, with the date.
    :return: Bytearray, with the time stored in little endian format.
    """
    return bytearray(struct.pack('<I',
                                 ((t.year % 100) * 12 * 31 + (
                                     (t.month - 1) * 31) + t.day - 1) *
                                 (24 * 60 * 60) + (
                                     t.hour * 60 + t.minute) * 60 + t.second
                                 ))