internet_time 1.0.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.
- data/CHANGELOG +5 -0
- data/LICENSE +27 -0
- data/README +16 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/lib/internet_time.rb +34 -0
- metadata +68 -0
data/CHANGELOG
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
== Internet Time
|
2
|
+
|
3
|
+
Copyright (c) 2010, Paul Philippov <themactep@gmail.com>
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without modification,
|
7
|
+
are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
* Redistributions of source code must retain the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer.
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of the PPDS.WS nor the names of its contributors may be used
|
15
|
+
to endorse or promote products derived from this software without specific
|
16
|
+
prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
= Internet Time
|
2
|
+
|
3
|
+
Swatch Internet Time extension to Ruby Time class.
|
4
|
+
|
5
|
+
Installation:
|
6
|
+
$ sudo gem install internet_time
|
7
|
+
|
8
|
+
Usage:
|
9
|
+
require 'internet_time'
|
10
|
+
Time.now.to_beats # => "@234"
|
11
|
+
|
12
|
+
Author:
|
13
|
+
Paul Philippov <themactep@gmail.com>
|
14
|
+
|
15
|
+
License:
|
16
|
+
New BSD License
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
|
5
|
+
spec = Gem::Specification.new do |s|
|
6
|
+
s.name = 'internet_time'
|
7
|
+
s.version = File.read('VERSION')
|
8
|
+
s.date = File.mtime('VERSION')
|
9
|
+
|
10
|
+
s.summary = %Q{Swatch Internet Time extension to Ruby Time class}
|
11
|
+
s.description = %Q{Swatch Internet time extension to Ruby Time class}
|
12
|
+
s.homepage = 'http://themactep.com/'
|
13
|
+
s.author = 'Paul Philippov'
|
14
|
+
s.email = 'themactep@gmail.com'
|
15
|
+
s.version = File.read('VERSION')
|
16
|
+
s.date = File.mtime('VERSION')
|
17
|
+
|
18
|
+
s.files = FileList["{lib}/**/*","[A-Z]*"].to_a
|
19
|
+
s.require_path = "lib"
|
20
|
+
|
21
|
+
s.has_rdoc = true
|
22
|
+
s.extra_rdoc_files = ['README', 'LICENSE']
|
23
|
+
|
24
|
+
s.rubyforge_project = 'internet_time'
|
25
|
+
end
|
26
|
+
|
27
|
+
Rake::GemPackageTask.new(spec) do |p|
|
28
|
+
p.gem_spec = spec
|
29
|
+
p.need_tar = true
|
30
|
+
p.need_zip = true
|
31
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Swatch Internet Time extension to Ruby Time class
|
4
|
+
# Copyright 2009 Paul Philippov <themactep@gmail.com>
|
5
|
+
#
|
6
|
+
# This program is free software. It may be redistributed and/or modified
|
7
|
+
# under the terms of the New BSD licence.
|
8
|
+
#
|
9
|
+
# $Id: beats.rb,v 1.0 2010/04/06 13:33:01 themactep Exp $
|
10
|
+
#++
|
11
|
+
|
12
|
+
# The library add Swatch Internet Time capability to the standard Ruby Time class.
|
13
|
+
# Its usage is very straightforward:
|
14
|
+
#
|
15
|
+
# require 'internet_time'
|
16
|
+
# Time.now.to_beats # => @234
|
17
|
+
#
|
18
|
+
class Time #:nodoc:#
|
19
|
+
|
20
|
+
SECOND_PER_BEAT = 86.4 # Amount of seconds in a single .beat
|
21
|
+
BMT_OFFSET_SEC = 3600 # Biel Mean Time offset to UTC in seconds
|
22
|
+
|
23
|
+
# Time in Biel Mean Time (UTC+1)
|
24
|
+
def bmt
|
25
|
+
self.utc + BMT_OFFSET_SEC
|
26
|
+
end
|
27
|
+
|
28
|
+
# Time in .beats
|
29
|
+
def to_beats
|
30
|
+
"@%03d" % [ ((bmt.hour * 60 + bmt.min) * 60 + bmt.sec) / SECOND_PER_BEAT ]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# vim: ts=2
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: internet_time
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Paul Philippov
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-06 00:00:00 +07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Swatch Internet time extension to Ruby Time class
|
22
|
+
email: themactep@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README
|
29
|
+
- LICENSE
|
30
|
+
files:
|
31
|
+
- lib/internet_time.rb
|
32
|
+
- CHANGELOG
|
33
|
+
- README
|
34
|
+
- Rakefile
|
35
|
+
- LICENSE
|
36
|
+
- VERSION
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://themactep.com/
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project: internet_time
|
63
|
+
rubygems_version: 1.3.6
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Swatch Internet Time extension to Ruby Time class
|
67
|
+
test_files: []
|
68
|
+
|