]> git.pond.sub.org Git - empserver/commitdiff
Fix parsing of 24:00 in game_hours and update_demandtimes
authorRon Koenderink <rkoenderink@yahoo.ca>
Mon, 10 Nov 2008 00:06:51 +0000 (18:06 -0600)
committerRon Koenderink <rkoenderink@yahoo.ca>
Mon, 10 Nov 2008 00:06:51 +0000 (18:06 -0600)
daytime() rejects 24:00 as invalid.  This makes daytime_range()
fail, is_daytime_allowed() ignore this and later ranges silently.
Broken in commit acdee1e3, v4.2.15.

src/lib/common/hours.c

index bd12a7addd16ec472fbb38dc0cd33d846e97c791..b07f2d1a6d350408bb05352e654dec0d0f701d38 100644 (file)
@@ -153,7 +153,7 @@ daytime(char *str, int *min)
     unsigned long h, m;
 
     h = strtoul(str, &end, 10);
-    if (end == str || h > 23)
+    if (end == str || h > 24)
        return NULL;
 
     if (*end++ != ':')
@@ -163,6 +163,8 @@ daytime(char *str, int *min)
     m = strtoul(str, &end, 10);
     if (end == str || m > 59)
        return NULL;
+    else if (h == 24 && m != 0)
+       return NULL;
 
     *min = 60 * h + m;
     return end;