# File lib/uuid.rb, line 154 154: def initialize 155: @drift = 0 156: @last_clock = (Time.now.to_f * CLOCK_MULTIPLIER).to_i 157: @mutex = Mutex.new 158: 159: if File.exist?(self.class.state_file) then 160: next_sequence 161: else 162: @mac = Mac.addr.gsub(/:|-/, '').hex & 0x7FFFFFFFFFFF 163: fail "Cannot determine MAC address from any available interface, tried with #{Mac.addr}" if @mac == 0 164: @sequence = rand 0x10000 165: 166: open_lock 'w' do |io| 167: write_state io 168: end 169: end 170: end