Tuesday, October 24, 2017

Paradise ponders: NTP, C, and a nice moment edition...

Paradise ponders: NTP, C, and a nice moment edition...  So a reader wrote and said “I know a bit about NTP, and I’d love to see your ntpq output!”  Well, ok then: here it is, as of a couple minutes ago:

remote           refid      st t when poll reach   delay   offset  jitter
oPPS(0)          .PPS.            0 l   13   16  377    0.000    0.000   0.001
*level1f.cs.unc. .PPS.            1 u    3   64  377   77.729    1.578   1.958
+clock.sjc.he.ne .CDMA.           1 u   60   64  377   32.103    2.562   0.943
-toofishes.net       2 u   61   64  325   72.172    5.609   1.657
+pbx.cytranet.ne    3 u   16   64  377   31.646    1.925   2.052

Now I know that only the geekiest amongst you will have any clue at all what you're seeing there.   If you're curious, everything you need to understand it is available here.  That output was generated with “ntpq -p”; it's a peers report.  The important bits to me are where I've highlighted it in orange: that's the offset and jitter, in milliseconds, for my little NTP server.  A zero in those measurements would be perfect; I'm pretty darned close! :)  My GPS-based timing unit is currently reporting (separately) a maximum error of 8 nanoseconds in it's pulse-per-second output, and that's what my NTP server is using for a reference (that's what the “oPPS(0)” refers to).  The other interesting piece of information I see is highlighted in red.  That's telling me that the toofishes.net NTP server I'm using as a possible reference has not responded to 3 of the last 8 queries my NTP server sent to it.  The “-” at the far left of that line tells me that my NTP server is ignoring it, most likely because of these errors.

I spent a good part of the day working on my GPS configuration and monitoring program, written in C.  I'm really enjoying this “close to the metal” experience again – it's a bit like being back in the '70s and early '80s, when this sort of development was the only kind I did.  On the other hand, it's also driving home for me just what a rich development environment I've been using with Java and JavaScript.  In C I find myself writing code for lots of different things that I haven't had to think about for years.  For example, today I wrote a set of C functions that implement some of the features of Java's standard ByteBuffer class.  That's a really handy thing for encoding or decoding binary data, which is exactly what I have to do for this GPS.  There's nothing even remotely like it in the standard C library!  I did find lots of libraries on the web, but ... knowing nothing about them, if it's something easy, I'll just do it myself.  And ByteBuffers are, in fact, almost trivially easy, so I rolled my own.  So far, if it's not in the Gnu Standard C library, I'm doing it myself.  I'm sure I'll run into something eventually that I'll want to borrow – but not yet.

Yesterday Debbie and I went to Aggie's Creamery for an ice cream cone.  Of course, as always, they were outrageously delicious.  When I first walked in, there were only two other customers there; they had just finished getting their ice cream.  One was a young woman, perhaps 25 years old.  The other was a much older man, maybe 85 or 90, very frail, a little confused, barely able to walk.  The young woman was, I suspect, his granddaughter.  I watched them, unseen, for a minute or so, just delighted by the scene.  The young woman was very solicitous of the old man, watching out and helping in many little ways.  She was clearly happy about his reaction to the ice cream: he was enjoying his little cup of chocolate wonderfulness at the same time she was trying to guide him into the safety of a seat at a little table.  He was distracted by everything: the shop, the bustling employees, the task of getting a spoonful of ice cream into his mouth, and the difficulty of walking in his condition.  Nevertheless, there was a huge grin on his face and he was making utterly unrestrained happy noises.  The young woman finally got him safely down, and as she sat down she turned toward me – and I could see her happy satisfaction with the moment.  She glanced at me and she saw my smile and thumbs up, and responded with a big grin of her own.  Just a sweet, happy moment: a younger person taking pleasure in making someone she cares about happy.  And in that she certainly succeeded...