Path: utzoo!utgpu!water!watmath!clyde!bellcore!tness7!tness1!splut!jay From: jay@splut.UUCP (Jay Maynard) Newsgroups: comp.unix.microport Subject: YAMB: times(2) is broken in large model Keywords: this one's a real pain, too... Message-ID: <463@splut.UUCP> Date: 3 Apr 88 13:04:54 GMT Organization: Confederate Microsystems, League City, TX Lines: 43 I spent about 4 hours last night trying to figure out where I was going wrong with my use of the times(2) function. I wrote the test program below, and it would work fine; then I used it in a much larger system (the KA9Q TCP/IP package - the supplied timer routine only ticks once a second), and it would break. I didn't discover the problem until I compiled the test program with -Ml - then it, too, was broken. times(2) is documented to return, besides the cpu times in the structure that is passed as its parameter, a monotonically increasing number that is the elapsed real time in 60ths of a second since the machine was booted. In small model, it does this just fine; in large model, it always returns -1. (argh!!) Guess I'll have to go hack something up... Here's the test program. It will work fine (print the times(2) return value each time you hit enter) in small model, but will always print -1 if compiled with -Ml. -----------8<----------cut here-----------8<------------------ #include #include #include main() { long thistime, times(); int c; struct tms *timesbuf; for (; c != EOF; (c = getchar())) { thistime = times(timesbuf); printf(" %ld\n", thistime); } } -- Jay Maynard, EMT-P, K5ZC...>splut!< | GEnie: JAYMAYNARD CI$: 71036,1603 uucp: {uunet!nuchat,hoptoad!academ!uhnix1,{ihnp4,bellcore}!tness1}!splut!jay Never ascribe to malice that which can adequately be explained by stupidity. The opinions herein are shared by none of my cats, much less anyone else.