from java.util import Date from java.text import SimpleDateFormat channel = "ARS07-CECL-DPCT:BIN-PCT-STAT0-BIN" bins = 0 time_range = 30 now = System.currentTimeMillis() fmt = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") start = fmt.format(Date(now_ms - time_range * 1000 )) end = fmt.format(Date(now)) set_exec_pars(reset=True) # A different file on each time filename = get_exec_pars().path d=Daqbuf(None, "sls-archiver") d.saveQuery(filename, channel, start, end, bins)