Simple command line tool to sanity check time synchronization between an NTP server and a PXM meter
Queries NTP server and gets offset from system clock. Queries meter time and gets the offset from system clock by sampling and averaging the samples with the lowest round-trip times. Offsets are compared to get the difference between the meter time and the NTP server time.
- Working Ruby environment
git clone https://github.com/hahodgins/ru_ontime.git
cd ru_ontime
bundle
# test_time.rb needs the NTP server address, meter ip address, and a range of registers to poll
./test_time.rb ntp_server_address meter_ip reg_start..reg_end
# firmwaregrab.rb just needs the meter ip address and firmware register
./firmwaregrab.rb meter_ip firmware_reg
For repeated polling, use config.yml to store NTP server address, meter IP address, modbus register range
poll_cfg:
ntp_server: 'time.nist.gov'
meter_ip: '123.45.0.67'
time_regs_str: '1000..1007'
Multiple meters (of the same type) can be polled at once by providing a list: '123.45.0.1, 123.45.0.2, ...'
- 0.1.3
- Added handling for polling multiple meters at once
- 0.1.2
- Added config.yml and handling in test_time.rb
- 0.1.1
- Initial Release
