On Jun 4, 2005, at 4:54 PM, Jakob Peterh�nsel wrote:

If anyone have pointers, please let me know.

I'm doing� a SNMP probe and have an Interger returned that is the services uptime in sec's.

I think my mind turned on me, as I can't seem to figure out how to get that shown as a human readable string.

The strftime functions seem to return the time in relation to unix posix time (01011970)


If you want the uptime to be displayed as: "xx days, hh:mm:ss" then you can use:

sprintf( "%d days, %d:%2.2d:%2.2d", $uptime / 86400, ($uptime % 86400)/3600, ($uptime % 86400 % 3600)/60, $uptime % 60)

(Note: The result of the expression $uptime / 86400 will almost always have a fractional part -- the %d just prints the whole part.)

If you want to display the services start time in local time, you can use:

  strftime( "%x %X", time() - $uptime)

time() returns current time in unix time.

Regards,

Bill Fisher
Dartware, LLC


____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

Reply via email to