import time


def unix_time(ret_int=False):
    """
    Get unix time and convert to nanoseconds to match the 
    time resolution of the MDML's time-series database, InfluxDB.


    Parameters
    ----------
    ret_int : bool
        True to return time as an integer. False to 
        return as a string.

    Returns
    -------
    string or int
        Unix time in nanoseconds 
    """
    unix_time = format(time.time() * 1000000000, '.0f') #1,000,000,000
    if ret_int:
        return int(unix_time)
    else:
        return unix_time