shithub: gefs

Download patch

ref: 1a37a6bb30e050e20e53e36abeb8fda10398f3f9
parent: 4ea3a16c31fb04f4df946b96a675133ee9589490
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Dec 2 11:21:14 EST 2023

fs: increment hour/min outside mount loop

multiple increments means we cycle through the
ring buffer too fast, and keep too few snaps

--- a/fs.c
+++ b/fs.c
@@ -2364,7 +2364,6 @@
 				snprint(mnt->hourly[h], sizeof(mnt->hourly[h]),
 					"%s@hour.%τ", mnt->name, tmfmt(&now, "YYYY.MM.DD[_]hh:mm:ss"));
 				snapmsg("main", mnt->hourly[h], Lauto);
-				h = (h+1)%24;
 			}
 			if(now.min != then.min){
 				if(mnt->minutely[m][0] != 0)
@@ -2372,9 +2371,12 @@
 				snprint(mnt->minutely[m], sizeof(mnt->minutely[m]),
 					"%s@minute.%τ", mnt->name, tmfmt(&now, "YYYY.MM.DD[_]hh:mm:ss"));
 				snapmsg("main", mnt->minutely[m], Lauto);
-				m = (m+1)%60;
 			}
 		}
+		if(now.hour != then.hour)
+			h = (h+1)%24;
+		if(now.min != then.min)
+			m = (m+1)%60;
 		then = now;
 		poperror();
 	}