/** * @param UniversalTimestamp $model * @param UTCDateTime $data */ public function decodeUniversalTimestamp(&$model, $data) { CodeGuard::checkTypeAndThrow($data, 'MongoDB\\BSON\\UTCDateTime', CodeGuard::CHECK_NULL_OK); // account for difference between .NET and Linux epoch // (which produces negative milliseconds in UTCDateTime then causes an exception in UniversalTimestamp) if ((int) (string) $data < 0) { $data = new UTCDateTime(0); } parent::decodeUniversalTimestamp($model, $data); }