Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. $time_marker = 0;
  2. function mark_timer(){
  3. $time = microtime();
  4. $time = explode(' ', $time);
  5. $time = (float)$time[1] + (float)$time[0];
  6. $_SESSION["time_marker"] = $time;
  7. }
  8. function end_and_print_timer($caption = ""){
  9. $time = microtime();
  10. $time = explode(' ', $time);
  11. $time = (float)$time[1] + (float)$time[0];
  12. $finish = $time;
  13.  
  14. $total_time = round(($finish - $_SESSION["time_marker"]), 4);
  15.  
  16. if(!empty($caption)){
  17. echo "<br/>$caption";
  18. }
  19. echo $total_time . "secs";
  20. }
  21. function reset_timer(){
  22. $_SESSION["time_marker"] = 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement