in reply to Re: timer without modules
in thread timer without modules

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: timer without modules
by Anonymous Monk on Nov 09, 2009 at 02:43 UTC
      awesome, thanks alot for that bit of info there. thing is overall since im new to most of the things im doing here, i want to keep away from 3rd party as much as possible so i can learn as much as possible. so ill keep lookin for the hard way of doin this but gonna read that too now lol
        Assuming there is a module out there that does what you want to do, you can learn a lot by just reading the source code. That should show you how to do it.

      im just trying to compair for example,
      user triggers event at 12:00am, script then refuses another request till say maybe 12:01am

      (preferably without halting the entire script because that would more than likely cause the bot to ping out)
      i have been messing with using just time() to compair but as i said before *noobish at this*.

        time() returns the number of seconds since the epoch. When your function is called check if the value from time() is greater than the previous stored value + 60 seconds. If there is no previous value 0|undef + 60 will certainly be less than time() returns.

        your problem may be more with deciding which data structure you want to use to store these time stamps for each user. A global hash keyed on user name would be the simplest if a little cludgy.

        Cheers,
        R.

        Pereant, qui ante nos nostra dixerunt!