From 4473c12e5508987a329857b01738f2d19bbfd681 Mon Sep 17 00:00:00 2001
From: davidh-ssec <david.hoese@ssec.wisc.edu>
Date: Thu, 4 Jan 2018 13:11:06 -0600
Subject: [PATCH] Fix handling of midnight on loggernet rotate

---
 scripts/loggernet_rotate.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/loggernet_rotate.sh b/scripts/loggernet_rotate.sh
index 2498caf..20ca917 100755
--- a/scripts/loggernet_rotate.sh
+++ b/scripts/loggernet_rotate.sh
@@ -49,13 +49,14 @@ EOF
 #}
 
 # completes almost every feature of the below for loops
-# TODO: if file doesn't exist add the header
-# TODO: Handle output file suffix
+# specially handles 2400 which should go for the next day, not the past day
 yyyy_jjj_tower_split() {
     awk_command='
 NR>header_size {
 time_spec = sprintf("%04d 01 %03d 00 00 00", $2, $3);
 epoch_seconds = mktime(time_spec);
+if ($4 == "2400")
+    epoch_seconds = epoch_seconds + 86400;
 file_date = strftime("%Y-%m-%d", epoch_seconds);
 jday = strftime("%j", epoch_seconds);
 y = strftime("%Y", epoch_seconds);
-- 
GitLab