Time-Dependent Energy and Resource Management in Mobility-Aware D2D-Empowered 5G Systems