The MJD60K problem.

Forums General Discussion The MJD60K problem.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #615921
    Dr Paul Leyland

    OK, hands up all those whose software has broken because the MJD (Modified Julian Date) flipped from 59999 to 60000 yesterday.

    As far as I know, all my code is MJD60K clean but can’t vouch for everything I use which has been written by others.

    If anything has broken I’ll report here so that others may also take action if they wish.


    Nick James

    It would have to be rather weird software since I would think that MJD would almost always be stored as a double. I suppose in some odd cases it might be stored as an uint16_t but then it would break at 65536, not 60000 and I have no idea why anyone would do that.

    Dr Paul Leyland

    It is not just a matter of storage. For instance, some years ago one of my Perl scripts contained this

        my ($star, $jd, $mag);
        while (<INPUT>) {
            if (/^Variable\s+(.*)/) {
                $star = $1 and next;
            } elsif (/^(245\d+\.\d+)\tV\t(.*?)\t/) {
                ($jd, $mag) = ($1, $2);
                $mag =~ s/\[/</ or $mag = sprintf “%.2f”, $mag;
                my ($year, $month, $day) = jd2gregorian ($jd + 0.5);
                printf “%s\t%.3f\t%s\tLEY\n”, $star, $day, $mag;

    Spot the bug.

    Dr Paul Leyland

    I remember a similar Y2K bug in a clock display. The coder appended the year to “19”, rather than adding to 1900. On 2000-01-01 the display read 1 Jan 19100.

    Takeaway message: character strings are not numbers, even when they look like them.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.