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 <redacted>
---
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