command_timer 0.0.3 → 0.0.4
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/lib/command_timer/version.rb +1 -1
- data/lib/command_timer.rb +8 -2
- metadata +1 -1
data/lib/command_timer.rb
CHANGED
@@ -6,8 +6,14 @@ require "command_timer/parser"
|
|
6
6
|
module CommandTimer
|
7
7
|
class << self
|
8
8
|
def ntp_time(server)
|
9
|
-
|
10
|
-
|
9
|
+
ENV['PATH'].split(':').each do |path|
|
10
|
+
if File.exists?(path + '/ntpdate')
|
11
|
+
server ||= 'ntp.nict.jp'
|
12
|
+
return parse_time(%x[ntpdate -q #{server}].scan(/[0-9]{2}:[0-9]{2}:[0-9]{2}/).first)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
puts "Warning: ntpdate not installed and use the local clock."
|
16
|
+
Time.now
|
11
17
|
end
|
12
18
|
|
13
19
|
def parse_time(str)
|