speedytime 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,8 +8,24 @@ VALUE speedytime_current(void)
8
8
  return INT2FIX(tv.tv_sec);
9
9
  }
10
10
 
11
+ VALUE speedytime_current_i(void)
12
+ {
13
+ struct timeval tv;
14
+ gettimeofday(&tv, NULL);
15
+ return INT2FIX(tv.tv_sec);
16
+ }
17
+
18
+ VALUE speedytime_current_f(void)
19
+ {
20
+ struct timeval tv;
21
+ gettimeofday(&tv, NULL);
22
+ double prec = tv.tv_sec + (tv.tv_usec / 1000000.0);
23
+ return DBL2NUM(prec);
24
+ }
25
+
11
26
  void Init_speedytime(void)
12
27
  {
13
28
  VALUE mSpeedytime = rb_define_module("Speedytime");
14
- rb_define_module_function(mSpeedytime, "current", speedytime_current, 0);
29
+ rb_define_module_function(mSpeedytime, "current", speedytime_current_i, 0);
30
+ rb_define_module_function(mSpeedytime, "current_f", speedytime_current_f, 0);
15
31
  }
@@ -1,3 +1,3 @@
1
1
  module Speedytime
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedytime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
4
  prerelease:
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Burke Libbey
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-09 00:00:00.000000000 Z
12
+ date: 2013-05-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Stupid simple gem to get the current timestamp without an object allocation
15
15
  email:
@@ -35,17 +35,17 @@ rdoc_options: []
35
35
  require_paths:
36
36
  - lib
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
- none: false
39
38
  requirements:
40
39
  - - ! '>='
41
40
  - !ruby/object:Gem::Version
42
41
  version: '0'
43
- required_rubygems_version: !ruby/object:Gem::Requirement
44
42
  none: false
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
44
  requirements:
46
45
  - - ! '>='
47
46
  - !ruby/object:Gem::Version
48
47
  version: '0'
48
+ none: false
49
49
  requirements: []
50
50
  rubyforge_project:
51
51
  rubygems_version: 1.8.23