Dumbsday — 220101000 > 2³¹−1

This fine New Year’s Day, 2022-01-01, some Microsoft Exchange users are reporting difficulties with their E-mail. Why? Well apparently some poindexter at the House of Shoddy decided that, with the rollicking fun of Y2K long behind, they would, in the interest of that goal of “efficiency” which is so cherished in Redmond, encode date and time values as YYMMDDhhmm, which get stored in 32-bit signed integers. First of all, this format has the simultaneous merits of not storing seconds, limiting precision to one minute, and also setting itself up for a Y2100 problem when the last two year digits roll over the next time. But the cherry on the sundae this Saturday is that while the number 2112312359, representing the last second of 2021 (2021-12-31 23:59) fits into the 31 bits of a positive 32-bit integer, the next second, 2201010000 (2022-01-01 00:00) does not. What happens then? Well, let’s run a little C++ program and see (I have used the C++ single quote digit separator gimmick to make the numbers easier to read: if you remove the quotes, it’s standard C).

#include <stdio.h>
#include <stdint.h>

int main(int argc, char *argv[]) {
    printf("%d\n", (int32_t) 21'12'31'23'59);
    printf("%d\n", (int32_t) 22'01'01'00'00);
    return 0;
}

$ g++ dumbsday.c ; ./a.out
2112312359
-2093957296

Yup, it goes negative, bollixing up any comparison involving such values.

Happy New Year from Microsoft!

10 Likes

Microsoft confirms the idiocy: “Email Stuck in Transport Queues”. They call it a “latent date issue” in this announcement which is dated “1/1/22”.

5 Likes