home *** CD-ROM | disk | FTP | other *** search
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.5 sun4m)
- MIME-Version: 1.0
- Subject: Re: Timing stuff
- References: <9604012043.AA003vp@ozzy.demon.co.uk> <4jsinv$9mi@senator-bedfellow.MIT.EDU>
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- Path: imada.ou.dk!breese
- From: breese@imada.ou.dk (Bjorn Reese)
- Message-ID: <1996Apr4.123716.19422@imada.ou.dk>
- Sender: news@imada.ou.dk
- Nntp-Posting-Host: gounod.imada.ou.dk
- Organization: Dept. of Math. & Computer Science, Odense University, Denmark
- Date: Thu, 4 Apr 1996 12:37:16 GMT
- Newsgroups: comp.sys.amiga.programmer
-
- > Brian Skreeg (oz@ozzy.demon.co.uk) wrote on Mon, 1 Apr 96 20:43:25 GMT:
- > : I'm writing a ircbot in SAS/C and I need to do things based on intervals.
- > : ie: if it doesn't have ops then ask at certain (10 secs) intervals for ops
- > : etc etc.
-
- You may reconsider asking for ops at a certain interval as it's
- really annoying if there's huge lag (the bot gets ops but doesn't
- discover it until several minutes later and floods the channel with
- op requests.) I'd rather suggest that it asks if it receives a
- ERR_CHANOPRIVSNEEDED.
-
- > : What would be the best way for implementing such a thing. It's
- > : basically just a simple program with an irc file open using TCP: and stdio
- > : CON: for seing what it's up to.
-
- The most simple way is to use time(). Although this gives a sloopy
- timing it is often sufficient. Insert something like this in your
- mainloop
-
- if (time(NULL) - lasttime > timedelay) {
- lasttime = time(NULL);
- dofunkystuff();
- }
-
- --
- Bjorn Reese Email: breese@imada.ou.dk
- Odense University, Denmark URL: http://www.imada.ou.dk/~breese
-
- "It's getting late in the game to show any pride or shame" - Marillion
-