import time
import re


def unixtime_directive(zonedata, unixtime=None):
    """ Filter binary zone data. Replace $UNIXTIME with current unix time. """
    if unixtime is None:
        unixtime = int(time.time())
    return re.sub(
        br'\$UNIXTIME\b',
        str(unixtime).encode("ascii"),
        zonedata,
        flags=re.IGNORECASE,
    )