@@ -170,8 +170,12 @@ bool DoAddMonths(TStorage& storage, i64 months, const NUdf::IDateBuilder& builde
170
170
storage.Year --;
171
171
newMonth += 12 ;
172
172
}
173
- if (storage.Year == 0 ) {
174
- storage.Year += months > 0 ? 1 : -1 ;
173
+ // The minimal year value for TTMStorage is 1970, but the
174
+ // check below makes coverity happy.
175
+ if constexpr (!std::is_same_v<TStorage, TTMStorage>) {
176
+ if (storage.Year == 0 ) {
177
+ storage.Year += months > 0 ? 1 : -1 ;
178
+ }
175
179
}
176
180
storage.Month = newMonth;
177
181
bool isLeap = NKikimr::NMiniKQL::IsLeapYear (storage.Year );
@@ -183,8 +187,12 @@ bool DoAddMonths(TStorage& storage, i64 months, const NUdf::IDateBuilder& builde
183
187
template <typename TStorage>
184
188
bool DoAddYears (TStorage& storage, i64 years, const NUdf::IDateBuilder& builder) {
185
189
storage.Year += years;
186
- if (storage.Year == 0 ) {
187
- storage.Year += years > 0 ? 1 : -1 ;
190
+ // The minimal year value for TTMStorage is 1970, but the
191
+ // check below makes coverity happy.
192
+ if constexpr (!std::is_same_v<TStorage, TTMStorage>) {
193
+ if (storage.Year == 0 ) {
194
+ storage.Year += years > 0 ? 1 : -1 ;
195
+ }
188
196
}
189
197
if (storage.Month == 2 && storage.Day == 29 ) {
190
198
bool isLeap = NKikimr::NMiniKQL::IsLeapYear (storage.Year );
0 commit comments