Re: [cc65] gettimeofday()

From: Marc 'BlackJack' Rintsch <marc1rintsch.de>
Date: 2012-01-23 08:51:21
Hi Karri,

> On 01/19/2012 09:15 PM, Ullrich von Bassewitz wrote:
> > On Thu, Jan 19, 2012 at 07:04:58AM +0200, Karri Kaksonen wrote:
> >> On 01/18/2012 10:25 PM, Ullrich von Bassewitz wrote:
> >      /* Read the clock */
> >      clock_t Ticks = clock();
> >      
> >      /* Calculate the time used */
> >      Ticks = clock() - Ticks;
> >      Sec = (unsigned) (Ticks / CLOCKS_PER_SEC);
> >      Milli = ((Ticks % CLOCKS_PER_SEC) * 1000) / CLOCKS_PER_SEC;
> 
> […]
> 
> But I assume that clock() is only available in C++.

No.  Just look at the code Uz is using above…

> Machine generated music is also interested in a steady ticker so it
> could build on top of clock() easily without a need for conversions
> to seconds and milliseconds.
> 
> […]
> 
> So I would go for implementing clock() and CLOCKS_PER_SEC.

…it is already implemented.  Just not documented in the function 
reference.  :-)  Take a look at the ``time.h``.

Ciao,
	Marc 'BlackJack' Rintsch
-- 
Axiomkraft - Nein Danke!

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jan 23 08:51:41 2012

This archive was generated by hypermail 2.1.8 : 2012-01-23 08:51:44 CET