Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Execuation Time Help

Comments in 'Plugin Development' started by Falk, Nov 21, 2013.

  1. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I thought it would be fun to put the execution time in my new plugin. Unfortunately in most cases it takes 0 seconds which looks awkward. Is there any way to get the time to a few decimal places?
  2. warnematt
    Offline

    warnematt New Member

    Joined:
    Nov 2, 2013
    Posts:
    30
    Minecraft User:
    Matt
    im kind of a noob when it comes to timers in PHP, but is the time in seconds or milliseconds? If its in MS, then 1000 = 1 second, which would be your issue, so try it like that, see if it fixes it
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    No i get the time with strtotime("now") which gives a unix timestamp, so seconds
  4. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Maybe, $this->api->schedule([time], array($this, "timer"), array(), true);
    the "timer" is the public function timer
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    That's not what I want to do :)
    I just want to find and retrieve the current unix time stamp with some decimal places for accuracy.
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Okay, I think I solved it
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I can use microtime()
  8. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Yes, but make sure to set the parameter to true. Otherwise it will return a string with first the milliseconds and than the seconds.
  9. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yeah

Share This Page

Advertisement