Bitcoin Forum

Other => Off-topic => Topic started by: bitlane on January 31, 2012, 06:21:18 AM



Title: PHP Time Help - CGMiner RPC API Monitoring
Post by: bitlane on January 31, 2012, 06:21:18 AM
I am currently still working on modifying an RPC Monitoring web page app that jjimmy_64 started for CGMiner and I have a quick question in regards to PHP Time.

http://members.shaw.ca/bitlane/bit/uptime.jpg

I am using gmdate and elapsed time to calculate/display my Miner's uptime.
This works great, but what I just realized is that it's only good for a 24hour period and I do not know the PHP or gmdate variable to use to display DAYS.

I am using:
Code:
UPTIME (H/M/S): ".gmdate("H:i:s", $elapsed)."

I have tried a bunch of ways and the closest I have come is to have DAYS (when added) displayed as 1, even after just starting the miner and displaying a few minutes of uptime.

Alternatively, is there a way I can keep HOURS rolling PAST the 24hour mark and just keep adding up, rather than rolling over and expecting a DAY portion of the script there to display ? I don't mind haivng it show "100hrs uptime" etc.....

Could anyone offer some help ?

I am a shitty coder, but a great copy/paster ;)

Thanks in advance,
bitlane.


Title: Re: PHP Time Help - CGMiner RPC API Monitoring
Post by: notme on January 31, 2012, 06:52:48 AM
http://php.net/manual/en/function.time.php


Title: Re: PHP Time Help - CGMiner RPC API Monitoring
Post by: Bitsky on January 31, 2012, 05:51:44 PM
Code:
$days=floor($elapsed/86400);
$time=gmdate('H:i:s', $elapsed%86400);