-
php
Get the system uptime by PHP
a simple code that call an external dll and use its function
10:04 Jul 28 2010 | Tags : w32api.dll,dll,win32,http://setcode.net/term,call,external,dll,dl,uptime,
if (!dl("php_w32api.dll")) {
echo "Unable to load php_w32api.dll";
exit;
}
$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);
2 comments
nice code but you forget summing a lot of system administrator closing this function thank,s for good code :)
Nice ... it's the first time for me to hear about the dl function