delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/05/00:06:31

Xref: news-dnh.mv.net comp.os.msdos.djgpp:773
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!hookup!news.kei.com!newshost.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!news.cic.net!infoserv.illinois.net!madison.tdsnet.com!gail.ripco.com!usenet
From: mambuhl AT ripco DOT com (Martin Ambuhl)
Subject: Re: [Q] Question about clock()
Sender: usenet AT rci DOT ripco DOT com (Net News Admin)
Cc: jim AT sun3 DOT gl DOT rhbnc DOT ac DOT uk (Jim Hu)
Organization: Ripco Internet BBS Chicago
Date: Tue, 4 Jul 1995 22:36:04 GMT
Lines: 37
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

jim AT sun3 DOT gl DOT rhbnc DOT ac DOT uk (Jim Hu)
in <3tb4u3$5cl AT sun DOT rhbnc DOT ac DOT uk> asks:


>   I compiled the program below with both Borland C 4.0 and djgpp (v1.12) with
>no flag at all. The size generated by bcc is larger and run slower compared
>with one generated by djgpp. However, the values printed out by the excutable
>from djgpp is much larger and suggesting the excutable is slower. I was cheated
>by clock(). Any comments?

[code snipped]

>output of clock()

>  bcc    Start 0  End 4840
>  djgpp  Start 0  End 384517


>  Why the excutable generated by bcc gives small number but actually takes
>much (much) longer time than one generated by djgpp. Does the small values
>actually mean the value is wrapped around ?

The return value from clock() must be converted to seconds by division by
CLOCKS_PER_SEC

bcc:
#define CLOCKS_PER_SEC 18.2
    4840 / 18.2 = 265.93 sec

djgpp:
#define CLOCKS_PER_SEC 1000000
    384517 / 1000000 = 0.38 sec

                                                                  
--
* Martin Ambuhl       net: mambuhl AT ripco DOT com
* Chicago, IL (USA)        martin DOT ambuhl AT chessboard DOT com

- Raw text -


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