sys-uptime 0.5.0-mswin32 → 0.5.1-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGES +10 -1
  2. data/README +1 -5
  3. data/lib/sys/uptime.rb +12 -4
  4. data/test/tc_uptime.rb +1 -1
  5. metadata +2 -2
data/CHANGES CHANGED
@@ -1,4 +1,13 @@
1
- == 0.5.0 - 31-Mar-2007
1
+ == 0.5.1 - 26-Jul-2007
2
+ * Fixed bug in the MS Windows version caused by incorrect parsing of an
3
+ MS specific date format (caused by a bug in Ruby 1.8.6). Thanks go to
4
+ Robert H. for the spot.
5
+ * Inlined the Rake installation tasks, so the install.rb file has been
6
+ removed.
7
+ * Added an 'install_gem' Rake task, and updated the README installation
8
+ instructions.
9
+
10
+ == 0.5.0 - 30-Mar-2007
2
11
  * For platforms that use C code, the code now always uses the sysctl()
3
12
  function if supported by your system. This replaces the platform specific
4
13
  checks I was doing for the various BSD flavors.
data/README CHANGED
@@ -7,12 +7,8 @@
7
7
  A C compiler, except for MS Windows.
8
8
 
9
9
  = Installation
10
- === Manual
11
10
  rake test (optional)
12
- rake install
13
- === Gems
14
- ruby sys-uptime.gemspec
15
- gem install sys-uptime-X.Y.Z.gem # Where 'X.Y.Z' are version numbers
11
+ rake install (non-gem) or rake install_gem (gem).
16
12
 
17
13
  == Notes
18
14
  For additional documentation see doc/uptime.txt.
data/lib/sys/uptime.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'win32ole'
2
2
  require 'socket'
3
- require 'parsedate'
3
+ require 'date'
4
4
 
5
5
  module Sys
6
6
  class Uptime
7
7
  class Error < StandardError; end
8
8
 
9
- VERSION = '0.5.0'
9
+ VERSION = '0.5.1'
10
10
 
11
11
  # Returns the boot time as a Time object.
12
12
  #
@@ -20,7 +20,7 @@ module Sys
20
20
  query = "select LastBootupTime from Win32_OperatingSystem"
21
21
  results = wmi.ExecQuery(query)
22
22
  results.each{ |ole|
23
- time_array = ParseDate.parsedate(ole.LastBootupTime)
23
+ time_array = parse_ms_date(ole.LastBootupTime)
24
24
  return Time.mktime(*time_array)
25
25
  }
26
26
  end
@@ -67,6 +67,14 @@ module Sys
67
67
 
68
68
  private
69
69
 
70
+ # Converts a string in the format '20040703074625.015625-360' into a
71
+ # Ruby Time object.
72
+ #
73
+ def self.parse_ms_date(str)
74
+ return if str.nil?
75
+ return Time.parse(str.split('.').first)
76
+ end
77
+
70
78
  def self.get_dhms(host)
71
79
  cs = "winmgmts://#{host}/root/cimv2"
72
80
  begin
@@ -79,7 +87,7 @@ module Sys
79
87
  now = Time.now
80
88
 
81
89
  results.each{ |ole|
82
- time_array = ParseDate.parsedate(ole.LastBootupTime)
90
+ time_array = parse_ms_date(ole.LastBootupTime)
83
91
  boot_time = Time.mktime(*time_array)
84
92
  break
85
93
  }
data/test/tc_uptime.rb CHANGED
@@ -10,7 +10,7 @@ include Sys
10
10
 
11
11
  class TC_Uptime < Test::Unit::TestCase
12
12
  def test_version
13
- assert_equal('0.5.0', Uptime::VERSION)
13
+ assert_equal('0.5.1', Uptime::VERSION)
14
14
  end
15
15
 
16
16
  def test_seconds
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: sys-uptime
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2007-03-30 00:00:00 -06:00
6
+ version: 0.5.1
7
+ date: 2007-07-26 00:00:00 -06:00
8
8
  summary: A Ruby interface for getting system uptime information.
9
9
  require_paths:
10
10
  - lib