Mega Code Archive

 
Categories / Php / Code Snippets
 

System uptime using php_w32api.dll functions

<?php $api = new win32; $api->registerfunction("bool QueryPerformanceCounter (float &lpPerformanceCount) From kernel32.dll"); $api->registerfunction("bool QueryPerformanceFrequency (float &lpPerformanceFrequency) From kernel32.dll"); $api->QueryPerformanceCounter($a); $api->QueryPerformanceFrequency($b); $c = $a/$b; $days = floor($c / 86400); echo gmstrftime("System uptime is $days Days, %H Hr, %M Min, %S Sec<br>", $c); ?>