Class Sys::Uptime
In: lib/linux/sys/uptime.rb
lib/windows/sys/uptime.rb
ext/sys/uptime.c
Parent: Object

The Uptime encapsulates various bits of uptime information

Methods

boot_time   boot_time   boot_time   days   days   days   dhms   dhms   dhms   hours   hours   hours   minutes   minutes   minutes   seconds   seconds   seconds   uptime   uptime   uptime  

Classes and Modules

Class Sys::Uptime::Error

Constants

VERSION = '0.5.4'   The version of the sys-uptime library.
UPTIME_FILE = '/proc/uptime'   The file to read uptime information from.
VERSION = '0.5.4'   The version of the sys-uptime library.
VERSION = 0.5.4   The version of this library

Public Class methods

Returns the boot time as a Time object.

Returns the boot time as a Time object.

Example:

   Sys::Uptime.boot_time # => Fri Dec 12 20:18:58 -0700 2008

Returns the time the system was booted as a Time object.

Example:

   Sys::Uptime.boot_time

Returns the total number of days of uptime.

Example:

   Sys::Uptime.days # => 2

Returns the total number of days the system has been up.

Returns the total number of days the system has been up on host, or the localhost if no host is provided.

Example:

   Sys::Uptime.days # => 1

Returns the uptime as a four element array, including days, hours, minutes and seconds.

Example:

   Sys::Uptime.dhms # => [1,9,24,57]

Calculates and returns the number of days, hours, minutes and seconds the system has been running as a four-element Array.

Calculates and returns the number of days, hours, minutes and seconds the host has been running as a four-element Array. The localhost is used if no host is provided.

Example:

   Sys::Uptime.dhms # => [1, 9, 55, 11]

Returns the total number of hours the system has been up.

Returns the total number of hours the system has been up on host, or the localhost if no host is provided.

Example:

   Sys::Uptime.hours # => 33

Returns the total number of hours of uptime.

Example:

   Sys::Uptime.hours # => 31

Returns the total number of minutes the system has been up on host, or the localhost if no host is provided.

Example:

   Sys::Uptime.minutes # => 1980

Returns the total number of minutes of uptime.

Example:

   Sys::Uptime.minutes # => 678

Returns the total number of minutes the system has been up.

Returns the total number of seconds the system has been up on host, or the localhost if no host is provided.

Example:

   Sys::Uptime.seconds # => 118800

Returns the total number of seconds the system has been up.

Returns the total number of seconds of uptime.

Example:

   Sys::Uptime.seconds # => 118800

Calculates and returns the number of days, hours, minutes and seconds the host has been running as a colon-separated string.

The localhost is used if no host is provided.

Example:

   Sys::Uptime.uptime # => "1:9:55:11"

Returns the uptime as a colon separated string, including days, hours, minutes and seconds.

Example:

   Sys::Uptime.uptime # => "1:9:24:57"

Calculates and returns the number of days, hours, minutes and seconds the system has been running as a colon-separated string.

[Validate]