#!/usr/bin/env ruby ipath = '/nwp/p0/incomplete/obsbf-etag.db' lpath = '/nwp/p0/latest/obsbf-etag.db' path = if File.exist?(ipath) then ipath elsif File.exist?(lpath) then STDERR.puts("missing #{ipath} - #{lpath} used") lpath else # ファイルが存在しない場合 STDERR.puts("missing #{ipath}") puts "535" exit 0 end mtime = File.mtime(path).utc now = Time.now.utc diff = now - mtime # 出力 printf "%6.3f\n", diff