]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/hours.c
Update copyright notice
[empserver] / src / lib / common / hours.c
index 7fadfc5462afef4869e905ff0fd6c42782fcc16f..07696ed15be5591ea731ed906fb4df7563685847 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  hours.c: Game hours determination; is it legal to play now?
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare, 1989
  *     Doug Hay, 1998
  *     Steve McClure, 1998
- *     Markus Armbruster, 2004
+ *     Markus Armbruster, 2004-2009
  */
 
 #include <config.h>
@@ -142,7 +142,7 @@ weekday(char *str, int *wday)
  * Else return NULL.
  * Time format is HOUR:MINUTE.  Initial whitespace is ignored.
  */
-char *
+static char *
 daytime(char *str, int *min)
 {
     /*
@@ -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;
@@ -175,7 +177,7 @@ daytime(char *str, int *min)
  * Else return NULL.
  * Format is HOUR:MINUTE-HOUR:MINUTE.  Initial whitespace is ignored.
  */
-char *
+static char *
 daytime_range(char *str, int *from_min, int *to_min)
 {
     char *end;