ntplib icon indicating copy to clipboard operation
ntplib copied to clipboard

issue35 - updated README for ntplib.ref_id_to_text() example, plus remove zero's from end of string

Open mahtin opened this issue 1 year ago • 0 comments

As per issue-35.

The README example is updated:

>>> ntplib.ref_id_to_text(response.ref_id, response.stratum)
193.190.230.66

If this was a stratum 0 or 1 source then it could do something like this:

>>> ntplib.ref_id_to_text(response.ref_id, response.stratum)
'Generic pulse-per-second'
>>> 

Secondly, just to make the code more Pythonic (not that I'm really that picky), the zeros at end of REF_ID_TABLE strings are removed. This improves code readability and also the potential to return a null in a string if the table is not matched.

All in all, as usual, a very useful library.

mahtin avatar Jan 07 '24 20:01 mahtin