Port-sparc archive

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

Re: [ntp:questions] Ntpd in uninterruptible sleep?



On Thu, Nov 17, 2011 at 05:14:33PM +0000, Dave Hart wrote:
> NTP_INSIST() always generates code, even if you build without DEBUG
> (using configure option --disable-debugging).

Ok, I don't see how the loop could be infinite then...

> Impressive.  Was this with "%.2f"?

Yes, actual test program attached. It has been running on a sparc64 machine
for several hours now, I'll run it on a 32bit sparc over night as well.

Martin
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <time.h>

int main(int argc, char **argv)
{
        union {
                double d;
                uint64_t bits;
        } u;
        uint32_t ul, uh;
        time_t now;
        char buf[1000];

        time(&now);
        srand(now);
        for (;;) {
                ul = rand();
                uh = rand();
                u.bits = (uint64_t)uh << 32 | ul;

                printf("random bits: %08" PRIx64 "\n", u.bits);
                snprintf(buf, 1000, " %.2f", u.d);
                printf("as double: %s\n\n", buf);
        }

        return 0;
}



Home | Main Index | Thread Index | Old Index