/*
* 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>
* Else return NULL.
* Time format is HOUR:MINUTE. Initial whitespace is ignored.
*/
-char *
+static char *
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++ != ':')
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;
* 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;