Class Sys::Uptime
In: lib/windows/sys/uptime.rb
lib/unix/sys/uptime.rb
lib/unix/sys/uptime.rb
Parent: Object

The Uptime class encapsulates various bits of information regarding your system‘s uptime, including boot time.

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
Class Sys::Uptime::ExitStatus
Class Sys::Uptime::Timeval
Class Sys::Uptime::Tms
Class Sys::Uptime::Utmpx

Constants

VERSION = '0.6.0'   The version of the sys-uptime library.
VERSION = '0.6.0'   The version of the sys-uptime library
CTL_KERN = 1
KERN_BOOTTIME = 21
TICKS = 100
BOOT_TIME = 2
VERSION = '0.6.0'   The version of the sys-uptime library
CTL_KERN = 1
KERN_BOOTTIME = 21
TICKS = 100
BOOT_TIME = 2

Public Class methods

Returns the boot time as a Time object.

Example:

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

Returns a Time object indicating the time the system was last booted.

Example:

   Sys::Uptime.boot_time # => Mon Jul 13 06:08:25 -0600 2009

Returns a Time object indicating the time the system was last booted.

Example:

   Sys::Uptime.boot_time # => Mon Jul 13 06:08:25 -0600 2009

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 total number of days of uptime.

Example:

   Sys::Uptime.days # => 2

Returns the total number of days of uptime.

Example:

   Sys::Uptime.days # => 2

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 uptime as a four element array, including days, hours, minutes and seconds.

Example:

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

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

Example:

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

Returns the total number of hours of uptime.

Example:

   Sys::Uptime.hours # => 31

Returns the total number of hours of uptime.

Example:

   Sys::Uptime.hours # => 31

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 minutes of uptime.

Example:

   Sys::Uptime.minutes # => 678

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 seconds of uptime.

Example:

   Sys::Uptime.seconds => 118800

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 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"

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

Example:

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

[Validate]