The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#7
|
|||
|
|||
![]()
Yeah, you have to remove the largest period from the time as you move from, say, days down to seconds, otherwise, you end up counting things more than once.
Try this function. It is a little verbose, but the upside is that it is easier to understand/maintain. (I have not tested this code.) Code:
function get_elapsed_time_string($interval_in_seconds) { $diff = intval($interval_in_seconds); $days = intval($diff / 86400); // div by sec's in a day $diff -= $days * 86400; // then remove that amount $hours = intval($diff / 3600); // div by sec's in an hour $diff -= $hours * 3600; // remove the amount $minutes = intval(($diff +15) / 60); // roundup: 45secs = 1 min return "$days d, $hours h, $minutes m"; } |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|