command_timer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- 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)
|