www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/06/00:07:09

From: fredex AT fcshome DOT stoneham DOT ma DOT us
Message-Id: <199606060101.VAA05267@fcshome.stoneham.ma.us>
Subject: Re: Why doesnt this work!
To: riggscl AT one DOT net (blah)
Date: Wed, 5 Jun 1996 21:01:20 -0400 (EDT)
Cc: djgpp AT delorie DOT com
In-Reply-To: <4p5btk$5ic@news.cybermax.net> from "blah" at Jun 6, 96 01:23:00 am

Thinking furiously, blah wrote:
> int main(void)
> {
>    clock_t start, end;
>    start = clock();
>    end = clock();
>    printf("The time was: %f\n", (end - start) / CLK_TCK);
>    return 0;
> }
> 
> When i run this after compiling in gcc it always prints 0.00000!
> 
> any ideas?

Yes. (end-start)/CLK_TCK is an integral type, not a float. 

-- 
-------------------------------------------------------------------------------
 .----    Fred Smith    /                        Office: fred AT computrition DOT com 
( /__  ,__.   __   __ /  __   : /                                 508-663-2524 
 /    /  /   /__) /  /  /__) .+'           Home: fredex AT fcshome DOT stoneham DOT ma DOT us 
/    /  (__ (___ (__(_ (___ / :__                                 617-438-5471 
-------------------------------- Jude 1:24,25 ---------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019