Port-macppc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Problems with registers save/restore on context switch?



I ran this test on my G4 NetBSD 6.0.2 system, and also on my G3 5.2 system.

mercy$ cat lttest.c
#include <stdio.h>
#include <string.h>
#include <time.h>

void prttime(char *str, struct tm *tmp);

int
main(int argc, char **argv)
{
    struct tm tm;
    struct tm *tmp;
    time_t t;
    int i;

    t = 1;

    tzset();
    tmp = gmtime_r(&t, &tm);
    if (tmp == NULL) {
        perror("init localtime");
    }
    prttime("init", &tm);
    for (i = 0; i < 1000000000; ++i) {
        tmp = gmtime_r(&t, &tm);
        if (tmp == NULL) {
            perror("localtime");
            continue;
        }

        if (    tm.tm_year != 70 ||
                tm.tm_mon != 0 ||
                tm.tm_mday != 1 ||
                tm.tm_hour != 0 ||
                tm.tm_min != 0 ||
                tm.tm_sec != 1 ) {
            prttime("fail", tmp);
        }
    }

    return 0;
}

void
prttime(char *str, struct tm *tmp)
{
        printf("%s: %04d-%02d-%02dT%02d:%02d:%02d\n",
                str,
                1900 + tmp->tm_year, tmp->tm_mon + 1, tmp->tm_mday,
                tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
}
mercy$ 

Output below.

I'll run it on a 5.2 system on a G4 later and send results.

I think this is the same bug that is causing my analog runs to give
bad answers, and my apache and mysql servers to fall over intermittently.

This is a serious bug.

-dgl-

The 6.0.2 system fails:

mercy$ lttest
init: 1970-01-01T00:00:01
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 1970-01-01T00:00:02
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 1970-01-01T00:00:02
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 1970-01-01T00:00:03
fail: 1928-12-06T10:17:52
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2008-07-17T22:45:54
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 1975-11-14T02:20:59
fail: 2038-01-19T03:14:08
fail: 1925-12-01T09:01:32
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 2038-01-19T03:14:08
fail: 1970-01-01T00:00:02
fail: 2038-01-19T03:14:08
fail: 1970-01-01T00:00:02
mercy$ 

The 5.2 system runs flawlessly, as it should.

wonder$ time lttest
init: 1970-01-01T00:00:01
  828.50s real   808.87s user     0.00s system
wonder$ 


Home | Main Index | Thread Index | Old Index