git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Make maximum surf time really per day

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 1, 2008, 20:41 UTC
Message-ID
<alpine.DEB.1.00.0810012239030.22125@pacific.mpi-cbg.de.mpi-cbg.de>
In-Reply-To
<alpine.DEB.1.00.0810012229390.22125@pacific.mpi-cbg.de.mpi-cbg.de>

Earlier, when the maximum time was reached, we would block for 8 hours. The program description suggested that the maximum time should be per day instead, however. So rather check that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	I am sure your kids will hate me.  Now the trick to surf before 
	school, after school, and then late at night does not work 
	anymore.  :-(
	Well, the "late at night" would have interfered with next day's 
	"before school" anyway.
 tracker.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tracker.c b/tracker.c
index 1b26e7e..faa4a91 100644
--- a/tracker.c
+++ b/tracker.c
@@ -12,6 +12,9 @@
 
 #define TRACKER_FILE "/var/log/tracker/%s"
 
+/* Define this, just in case it changes some day */
+#define SECS_PER_DAY 86400
+
 enum state {
 	no_user, old_user, new_user
 };
@@ -43,7 +46,7 @@ static void update_fd(struct user *user, int fd, unsigned int s)
 	cur += s;
 
 	/* Has the user been logged out more than 8 hours? */
-	if (user->last - last >= 8*60*60)
+	if (user->last / SECS_PER_DAY != last / SECS_PER_DAY)
 		cur = 0;
 
 	left = max - cur;
-- 
1.6.0.2.GIT
Previous: Johannes SchindelinNext: Linus Torvalds
Message 3 of 10 in “Help with a tcl/tk gui thing..”
  1. Linus TorvaldsOct 1, 2008
  2. Change color at specified thresholdJohannes Schindelin, Oct 1, 2008
  3. Make maximum surf time really per dayJohannes Schindelin, Oct 1, 2008
  4. Linus TorvaldsOct 1, 2008
  5. Mikael MagnussonOct 1, 2008
  6. Linus TorvaldsOct 1, 2008
  7. Mikael MagnussonOct 2, 2008
  8. Linus TorvaldsOct 2, 2008
  9. Mikael MagnussonOct 2, 2008
  10. GUI: Add a progressbar to visualize the time that is leftBjörn Steinbrink, Oct 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.