Time-dependent polarization of CdTe gamma-ray detectors