Re: Timers

From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 08/11/04


Date: Wed, 11 Aug 2004 13:48:37 GMT

George wrote:
> I have created a program that sends msgs at certain rate. What is the
> best way to do this so that I get a consistent rate all the time?
> For example I want to send 5000 msgs per second, and 1000 msgs per
> second.
> I have used "usleep" and most of the time I get way less than what I
> expect mainly do to system interrupt.
>
> How do I get time to print like the following 3:12:30.83884838?
>
> Thanks
> George

The best method is to have your operating system
execute your function at a given time interval.
This is all operating system specific and best
answered in a newsgroup about your O.S.

For example, if your platform has an interrupt
that fires every millisecond, you could have
the interrupt call your function that sends out
a message (one of the 1000 per second).

-- 
Thomas Matthews
C++ newsgroup welcome message:
          http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq:   http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
          http://www.comeaucomputing.com/learn/faq/
Other sites:
     http://www.josuttis.com  -- C++ STL Library book


Relevant Pages

  • Re: Not sure if Im braging or complaining
    ... else remember "GEORGE", ... VME itself was a pretty nice operating system underneath (I got to ... The basement also housed the ... biggest battery I have ever seen, the size of a couple of large ...
    (rec.pets.cats.anecdotes)
  • Re: byte inversion in ciphertext
    ... Let's threaten throughout the linguistic squads, ... interrupt the old-fashioned cages. ... George never promotes until Susanne dedicates the ...
    (sci.crypt)
  • Re: VBA File Not Found!
    ... Hi George, ... Try posting on the developer newsgroup. ... Please see FAQ Item: 24. ... > clobber some file reference, resulting in the message "File Not ...
    (microsoft.public.project)
  • Re: Yet Another OE Slow Starter
    ... George: Sorry about the confusion. ... stumped and might suggest posting in a newsgroup for your operating system ... Please reply only to newsgroup. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Office files change locations on their own
    ... Tools | Options | file locations ... templates, and other items you create or use in Word. ... George Pease hunted and pecked: ... > never did before until the changed to the XP operating system. ...
    (microsoft.public.windowsxp.general)