Learning to Control under Time-Varying Environment