Guest User

Untitled

a guest
Jul 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. /**
  3. * Joshimane_Result
  4. *
  5. * A class contains benchmarking result.
  6. *
  7. * @author Yuya Takeyama
  8. */
  9. class Joshimane_Result
  10. {
  11. /**
  12. * Constructor.
  13. *
  14. * @param array $params Parameters of the job result.
  15. * + begin float When the job had begun.
  16. * + end float When the job had ended.
  17. */
  18. public function __construct($params)
  19. {
  20. $this->_begin = $params['begin'];
  21. $this->_end = $params['end'];
  22. }
  23.  
  24. /**
  25. * Gets the total time elapsed.
  26. *
  27. * @param string $format Format string passed to sprintf().
  28. * @return float|string
  29. */
  30. public function getTotalTime($format = NULL)
  31. {
  32. if (is_null($format)) {
  33. $result = $this->_end - $this->_begin;
  34. } else {
  35. $result = sprintf($format, $this->_end - $this->_begin);
  36. }
  37. return $result;
  38. }
  39. }
Add Comment
Please, Sign In to add comment