fix(bklog):Fix buffer drift via SECONDS
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Tue, 14 Jul 2020 02:08:49 +0000 (02:08 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Tue, 14 Jul 2020 02:08:49 +0000 (02:08 +0000)
commitf5024030c11cd53a1cfdb067f128e3047dff34a2
treed78683bedd97e13eddd94e1447d76cc3f61631f3
parentd5f5aa4e0f362dd76471b5440339ef249a5552aa
fix(bklog):Fix buffer drift via SECONDS

==Change 1==
Fix drift in when bklog starts reading data via `while read` by
enforcing buffer termination when SECONDS (script variable that
increments every second) rises above a number determined by the
current bufferRound number and bufferTTL.

==Change 2==
Also initially advance SECONDS so it aligns with the remainder of
dividing the current seconds remaining in the day by bufferTTL. The
result should be that, if the user specifies a bufferTTL value that is
a clean fraction of a time element (ex: a bufferTTL of 5 minutes = 300
seconds), then each buffer round should start at a clean fraction of
absolute time with respect to the day (ex: 02:05, 02:10, 02:15,
etc.). This may assist searching through saved files since instead of
files named:

20200714T000019+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T000521+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T001023+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T001525+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T002027+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T002529+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T003031+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T003533+0000--PT5M0S..hostname_location.nmea.gz.age

they will be named something more like:

20200714T000000+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T000500+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T001000+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T001500+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T002000+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T002500+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T003000+0000--PT5M0S..hostname_location.nmea.gz.age
20200714T003500+0000--PT5M0S..hostname_location.nmea.gz.age

==Change 3==

Fix how the ISO-8601 duration string is calculated. Instead of using a
fixed value of `bufferTTL` seconds, record the epoch start and end
times (in seconds since 1970-01-01) of the main data gathering loop
and then calculate the difference. Now, actual deviations in buffer
gathering durations (ex: the first buffer round will likely be shorter
than a normal one) will be accurately represented.
exec/bklog