From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a7a9a65dd0529420 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-07-25 02:20:49 PST Path: nntp.gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!math.ohio-state.edu!sdd.hp.com!decwrl!pa.dec.com!mrnews.mro.dec.com!zuunix.zuo.dec.com!pbs From: pbs@zuunix.zuo.dec.com (Philip Shearer @ZUO-DC EBS-Team) Newsgroups: comp.unix.osf.osf1 Subject: Re: Alpha system clock calls Date: 25 Jul 1994 09:14:23 GMT Organization: Digital Equipment Corporation - Marlboro, MA Message-ID: <30vvpf$igr@mrnews.mro.dec.com> References: <1994Jul18.180219.17019@decvax.dec.com> NNTP-Posting-Host: zuunix.zuo.dec.com X-Newsreader: Tin 1.1 PL3 In article <1994Jul18.180219.17019@decvax.dec.com> you write: : : In article <301912$5te@masala.cc.uh.edu>, tony@uh.edu (Tony Alvarez) writes: : |> : |>I have been trying to use the following system clock calls on OSF/1 ver 2.0: : |> : |> : |>times(), gettimer(), getclock(), clock_gettime() : : Have you tried the man pages? They all have entries (the last in the : realtime man pages). : : times: return process execution times. It seems to be working. : The manual entry for times is brain dead. time_t times() is wrong!! It returns clock_t (see the header file ). Also the RETURN VALUES of the manual page reports that it returns "time in clock ticks since an arbitrary reference time" This is a POSIX standard so can be used for portable software. But is is not the best one to use for new software, I guess that clock_gettime() is "better" as it is in Draft POSIX and has finer granularity without the danger of overflow which is inherent in times(). TTFN Philip PS to convert that to somthing usefull sysconf(_SC_CLK_TCK) will return the number of tick per second so to calculate time to 10th of a second #define CT sysconf(_SC_CLK_TCK) #define TENTHS 10 #define SUBSEC TENTHS #define _getTimeout(t) (((long)t * (long)SUBSEC ) / (long)CT )