From: Steven Baltakatei Sandoval Date: Tue, 14 Jul 2020 02:08:49 +0000 (+0000) Subject: fix(bklog):Fix buffer drift via SECONDS X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/commitdiff_plain/f5024030c11cd53a1cfdb067f128e3047dff34a2?hp=f5024030c11cd53a1cfdb067f128e3047dff34a2 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. ---