#Uptime.pl (c)2005-6 Dream ƒrequency
#Uptime Displayer v2.2.0 (965355); Displays time since Windows booted
###
#ƒrequency Software - http://frequencysoftware.com
#Adult ƒrequency - Adult software - http://adultfrequency.com
#Dream ƒrequency - Useful software - http://dreamfrequency.com
###
#Display of the amount of time since your computer was booted.  This is
#called the uptime.  The display is precise to the second.  Windows GUI
#clock version available from Download.com, "Precise information... worth
#evaluating," Download.com Editor's Review.  http://www.download.com/
#Uptime-Clock/3000-2094-10450928.html
#
#Find out if your computer has been running for 2 days, 10 hours or you
#have just turned it on.
#
#Windows counts the number of milliseconds since it was last booted
#(started).  This application reads that count, then turns it into time
#on a 24hour clock and in kiloseconds.  This interesting Windows feature
#was discovered as a static display in AIDA32, the system info
#application.
#
#This Perl script is freeware and may be freely redistributed unchanged.
###
$OutputStr="";
$UpDays=0;
$UpHours=0;
$UpMins=0;
$UpSecs=0;
$Uptime=Win32::GetTickCount;

$Uptime/=1000;
$ks=$Uptime/1000;
$ks=sprintf ("%.0f", $ks);
$Uptime=int $Uptime;
$UpSecs=$Uptime % 60;
$Uptime/=60;
$Uptime=int $Uptime;
if ($Uptime>59) {
	$UpMins=$Uptime % 60;
	$Uptime/=60;
	$Uptime=int $Uptime;
	if ($Uptime>23) {
		$UpHours=$Uptime % 24;
		$Uptime/=24;
		$UpDays=int $Uptime;
	}
	else { $UpHours=$Uptime; }
}
else { $UpMins=$Uptime; }
if ($UpSecs==1) { $OutputStr="1 second"; }
elsif ($UpSecs==0) { $OutputStr="precisely"; }
else { $OutputStr="$UpSecs seconds"; }
if ($UpMins==1) { $OutputStr="1 minute and $OutputStr"; }
elsif ($UpMins>1) { $OutputStr="$UpMins minutes and $OutputStr"; }
if ($UpHours or $UpDays) {
	if ($UpHours==1) { $OutputStr="1 hour and $OutputStr"; }
	elsif ($UpHours>1) { $OutputStr="$UpHours hours and $OutputStr"; }
	if ($UpDays) {
		if ($UpDays==1) { $OutputStr="1 day and $OutputStr"; }
		else { $OutputStr="$UpDays days and $OutputStr"; }
	}
}
print "Uptime is $OutputStr (${ks}ks).\n"; 
print "Visit Frequency Software at: http://frequencysoftware.com.\n";
