Optimization of Long-Run Average-Flow Cost in Networks With Time