At 13.33 -0400 2000.05.19, Jim Correia wrote: >On 11:44 AM 5/19/00 "Jay Bedsole" <rwdd30@email.sps.mot.com> wrote: > >> > Are there any pre-built features in MacPerl that allow me >> > to get uptime/total uptime? >> >> What you're really asking is, "are there any pre-built >> features in the MacOS to support uptime statistics". >> >> I'm not aware of any > >TickCount is an unsigned long. It is the number of ticks (1/60 second) >since the computer has been up. You'd have to have your computer up for >a long time before the counter would roll over. And TickCount is in Mac::Events. #!perl -w use Mac::Events; $ticks = TickCount(); $days = $ticks / 5184000; $hours = ($days - int($days)) * 24; $minutes = ($hours - int($hours)) * 60; $seconds = ($minutes - int($minutes)) * 60; printf "Computer has been up for %d days, %.2d:%.2d:%.2d\n", $days, $hours, $minutes, $seconds; __END__ Thanks, Jim! BTW, this appears to not show time since startup, but _running time_ since startup. A PowerBook or iBook that has been asleep does not keep the counter running, it appears. My wife's iBook has been sleeping for several hours and reports only one hour of uptime when I run this script. -- Chris Nandor | pudge@pobox.com | http://pudge.net/ Andover.Net | chris.nandor@andover.net | http://slashcode.com/ # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org