oletime 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/oletime.rb +12 -6
- data/lib/oletime/version.rb +1 -1
- data/oletime.gemspec +13 -21
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70be8ef262d65868d724421b3b0066f61258eb1c
|
|
4
|
+
data.tar.gz: 100935ddd223f5bc7a7a55a1ad63a4146690125d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87dafcebc39f4c333b6404f7b9ecce330de90e9ec1ccf3e273dc0ca504915fc39113d21e209e561afd0476f3be91a0957e23fd99c546dd00e56d53107d31d0da
|
|
7
|
+
data.tar.gz: 500567cc41c7976720b5b54bf4af1bde870e10b4649ba838b4d8be3c7670fd5a2425a89f8bcaee1720818b7eb3ca5b3e4e70efb17f676f7b9337f73f2328d14d
|
data/README.md
CHANGED
data/lib/oletime.rb
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'oletime/version'
|
|
2
2
|
|
|
3
3
|
module Oletime
|
|
4
|
+
# Holds `time` value and converts to and from ole float value
|
|
4
5
|
class Time
|
|
5
6
|
attr_accessor :time
|
|
6
|
-
def initialize(year, month=nil, day=nil, hour=nil, minute=
|
|
7
|
-
|
|
7
|
+
def initialize(year = nil, month = nil, day = nil, hour = nil, minute = nil,
|
|
8
|
+
second = nil, utc_offset = nil)
|
|
9
|
+
if year
|
|
10
|
+
@time = ::Time.new(year, month, day, hour, minute, second, utc_offset)
|
|
11
|
+
else
|
|
12
|
+
@time = ::Time.new.utc
|
|
13
|
+
end
|
|
8
14
|
end
|
|
9
15
|
|
|
10
16
|
def self.from_ole(value)
|
|
11
|
-
|
|
12
|
-
t.time = ::Time.at((value -
|
|
17
|
+
new(::Time.now.year).tap do |t|
|
|
18
|
+
t.time = ::Time.at((value - 25_569) * 86_400).utc
|
|
13
19
|
end
|
|
14
20
|
end
|
|
15
21
|
|
|
16
22
|
def to_ole
|
|
17
|
-
(@time.to_f /
|
|
23
|
+
(@time.to_f / 86_400) + 25_569
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
def to_s
|
data/lib/oletime/version.rb
CHANGED
data/oletime.gemspec
CHANGED
|
@@ -4,33 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
require 'oletime/version'
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
7
|
+
spec.name = 'oletime'
|
|
8
8
|
spec.version = Oletime::VERSION
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
9
|
+
spec.authors = ['Sandro Mehic']
|
|
10
|
+
spec.email = ['sandromehic@gmail.com']
|
|
11
11
|
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.description =
|
|
14
|
-
|
|
15
|
-
spec.
|
|
16
|
-
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
-
# if spec.respond_to?(:metadata)
|
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
-
# else
|
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
-
# "public gem pushes."
|
|
24
|
-
# end
|
|
12
|
+
spec.summary = 'Convert between OLE time and UNIX timestamp'
|
|
13
|
+
spec.description = 'Gem used for conversion of tim from OLE float '\
|
|
14
|
+
'datetime to UNIX timestamp and viceversa'
|
|
15
|
+
spec.homepage = 'https://github.com/sandromehic/oletime'
|
|
16
|
+
spec.license = 'MIT'
|
|
25
17
|
|
|
26
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
19
|
f.match(%r{^(test|spec|features)/})
|
|
28
20
|
end
|
|
29
|
-
spec.bindir =
|
|
21
|
+
spec.bindir = 'exe'
|
|
30
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
-
spec.require_paths = [
|
|
23
|
+
spec.require_paths = ['lib']
|
|
32
24
|
|
|
33
|
-
spec.add_development_dependency
|
|
34
|
-
spec.add_development_dependency
|
|
35
|
-
spec.add_development_dependency
|
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
36
28
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oletime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sandro Mehic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|