sys-uptime 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.5.2 - ???
2
+ * Fixed a date/time issue in the Windows version caused by Ruby itself.
3
+ * Fixed the Uptime.seconds, Uptime.minutes and Uptime.hours methods on MS
4
+ Windows.
5
+ * Renamed the test file to 'test_sys_uptime.rb'.
6
+ * Some minor updates to the Rakefile.
7
+
1
8
  == 0.5.1 - 26-Jul-2007
2
9
  * Fixed bug in the MS Windows version caused by incorrect parsing of an
3
10
  MS specific date format (caused by a bug in Ruby 1.8.6). Thanks go to
data/MANIFEST CHANGED
@@ -7,7 +7,7 @@
7
7
  * doc/uptime.txt
8
8
  * examples/test.rb
9
9
  * ext/extconf.rb
10
- * ext/uptime.c
10
+ * ext/sys/uptime.c
11
11
  * lib/sys/linux.rb
12
12
  * lib/sys/windows.rb
13
- * test/tc_uptime.rb
13
+ * test/test_sys_uptime.rb
data/doc/uptime.txt CHANGED
@@ -75,13 +75,13 @@ Uptime::Error
75
75
  Ruby's
76
76
 
77
77
  == Copyright
78
- Copyright 2002-2007, Daniel J. Berger
78
+ Copyright 2002-2008, Daniel J. Berger
79
79
 
80
80
  All Rights Reserved. This module is free software. It may be used,
81
81
  redistributed and/or modified under the same terms as Ruby itself.
82
82
 
83
83
  == Warranty
84
- This package is provided "as is" and without any express or
84
+ This library is provided "as is" and without any express or
85
85
  implied warranties, including, without limitation, the implied
86
86
  warranties of merchantability and fitness for a particular purpose.
87
87
 
data/ext/extconf.rb CHANGED
@@ -25,4 +25,4 @@ else
25
25
  have_header('utmpx.h')
26
26
  end
27
27
 
28
- create_makefile('sys/uptime')
28
+ create_makefile('sys/uptime', 'sys')
@@ -51,7 +51,7 @@
51
51
 
52
52
  #define MAXSTRINGSIZE 32 /* reasonable limit */
53
53
 
54
- #define SYS_UPTIME_VERSION "0.5.1"
54
+ #define SYS_UPTIME_VERSION "0.5.2"
55
55
 
56
56
  VALUE cUptimeError;
57
57
 
@@ -67,19 +67,19 @@ unsigned long get_uptime_secs()
67
67
 
68
68
  if(sysctl(mib, 2, &tv, &tvlen, NULL, 0))
69
69
  rb_raise(cUptimeError, "sysctl() call failed %s", strerror(errno));
70
-
70
+
71
71
  return time(NULL) - tv.tv_sec;
72
72
  #else
73
73
  struct tms tms;
74
74
  unsigned long seconds;
75
75
  seconds = times(&tms) / TICKS;
76
-
76
+
77
77
  if(-1 == seconds)
78
78
  rb_raise(cUptimeError, "times() function failed: %s", strerror(errno));
79
-
79
+
80
80
  if(seconds < 0)
81
81
  rb_raise(cUptimeError, "value returned larger than type could handle");
82
-
82
+
83
83
  return seconds;
84
84
  #endif
85
85
  }
@@ -98,7 +98,7 @@ static VALUE uptime_seconds()
98
98
  /*
99
99
  * call-seq:
100
100
  * Uptime.minutes
101
- *
101
+ *
102
102
  * Returns the total number of minutes the system has been up.
103
103
  */
104
104
  static VALUE uptime_minutes()
@@ -139,7 +139,7 @@ static VALUE uptime_uptime()
139
139
  {
140
140
  char c_string[MAXSTRINGSIZE];
141
141
  long seconds, days, hours, minutes;
142
-
142
+
143
143
  seconds = get_uptime_secs();
144
144
  days = seconds/86400;
145
145
  seconds -= days*86400;
@@ -168,15 +168,15 @@ static VALUE uptime_dhms()
168
168
  s = get_uptime_secs();
169
169
  d = s / (24*60*60);
170
170
  h = (s -= d*24*60*60) / ( 60*60);
171
- m = (s -= h* 60*60) / 60;
172
- s -= m* 60;
171
+ m = (s -= h* 60*60) / 60;
172
+ s -= m* 60;
173
173
 
174
- rb_ary_push(a, INT2FIX(d));
175
- rb_ary_push(a, INT2FIX(h));
176
- rb_ary_push(a, INT2FIX(m));
177
- rb_ary_push(a, INT2FIX(s));
174
+ rb_ary_push(a, INT2FIX(d));
175
+ rb_ary_push(a, INT2FIX(h));
176
+ rb_ary_push(a, INT2FIX(m));
177
+ rb_ary_push(a, INT2FIX(s));
178
178
 
179
- return a;
179
+ return a;
180
180
  }
181
181
 
182
182
  /*
@@ -203,7 +203,7 @@ static VALUE uptime_btime(){
203
203
  #else
204
204
  #ifdef HAVE_UTMPX_H
205
205
  struct utmpx* ent;
206
-
206
+
207
207
  setutxent();
208
208
 
209
209
  while( (ent = getutxent()) ){
@@ -229,18 +229,17 @@ void Init_uptime()
229
229
  /* The Sys module only serves as a toplevel namespace */
230
230
  mSys = rb_define_module("Sys");
231
231
 
232
- /* The Uptime class contains several class methods for obtaining uptime
233
- * information.
234
- */
232
+ /* The Uptime encapsulates various bits of uptime information */
235
233
  cUptime = rb_define_class_under(mSys, "Uptime", rb_cObject);
236
234
 
237
235
  /* The Uptime::Error class is raised if any of the Uptime methods fail */
238
236
  cUptimeError = rb_define_class_under(cUptime, "Error", rb_eStandardError);
239
-
240
- /* 0.5.0: The version of this package, returned as a String */
237
+
238
+ /* 0.5.2: The version of this library */
241
239
  rb_define_const(cUptime, "VERSION", rb_str_new2(SYS_UPTIME_VERSION));
242
240
 
243
- /* Class Methods */
241
+ /* Singleton Methods */
242
+
244
243
  rb_define_singleton_method(cUptime, "seconds", uptime_seconds, 0);
245
244
  rb_define_singleton_method(cUptime, "minutes", uptime_minutes, 0);
246
245
  rb_define_singleton_method(cUptime, "hours", uptime_hours, 0);
@@ -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.1', Uptime::VERSION)
13
+ assert_equal('0.5.2', Uptime::VERSION)
14
14
  end
15
15
 
16
16
  def test_seconds
metadata CHANGED
@@ -1,56 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: sys-uptime
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
7
- date: 2007-07-26 00:00:00 -06:00
8
- summary: A Ruby interface for getting system uptime information.
9
- require_paths:
10
- - lib
11
- email: djberg96@gmail.com
12
- homepage: http://www.rubyforge.org/projects/sysutils
13
- rubyforge_project: sysutils
14
- description: A Ruby interface for getting system uptime information.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.0
24
- version:
4
+ version: 0.5.2
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Daniel J. Berger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-13 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A Ruby interface for getting system uptime information.
17
+ email: djberg96@gmail.com
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - CHANGES
24
+ - README
25
+ - MANIFEST
26
+ - doc/uptime.txt
27
+ - ext/sys/uptime.c
31
28
  files:
32
29
  - doc/uptime.txt
33
- - test/tc_uptime.rb
30
+ - test/test_sys_uptime.rb
34
31
  - CHANGES
35
32
  - README
36
33
  - MANIFEST
37
34
  - ext/extconf.rb
38
- - ext/uptime.c
39
- test_files:
40
- - test/tc_uptime.rb
35
+ - ext/sys
36
+ - ext/sys/uptime.c
37
+ has_rdoc: true
38
+ homepage: http://www.rubyforge.org/projects/sysutils
39
+ post_install_message:
41
40
  rdoc_options: []
42
41
 
43
- extra_rdoc_files:
44
- - CHANGES
45
- - README
46
- - MANIFEST
47
- - doc/uptime.txt
48
- - ext/uptime.c
49
- executables: []
50
-
51
- extensions:
52
- - ext/extconf.rb
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 1.8.0
49
+ version:
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
53
56
  requirements: []
54
57
 
55
- dependencies: []
56
-
58
+ rubyforge_project: sysutils
59
+ rubygems_version: 1.2.0
60
+ signing_key:
61
+ specification_version: 2
62
+ summary: A Ruby interface for getting system uptime information.
63
+ test_files:
64
+ - test/test_sys_uptime.rb