]> git.pond.sub.org Git - empserver/blob - src/lib/commands/upda.c
Update copyright notice
[empserver] / src / lib / commands / upda.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  upda.c: Give the time of the next update
29  * 
30  *  Known contributors to this file:
31  *     Markus Armbruster, 2007
32  */
33
34 #include <config.h>
35
36 #include "commands.h"
37 #include "game.h"
38 #include "optlist.h"
39 #include "server.h"
40
41 /*
42  * Tell what the update policy is, and when the next update
43  * is likely to be.
44  */
45 int
46 upda(void)
47 {
48     time_t now, next, stop;
49
50     if (updates_disabled())
51         pr("UPDATES ARE DISABLED!\n");
52
53     (void)time(&now);
54     next = update_time[0];
55     if (next) {
56         pr("\nUpdates occur at times specified by the ETU rates.\n\n");
57         pr("The next update is at %19.19s.\n", ctime(&next));
58     } else {
59         pr("There are no regularly scheduled updates.\n");
60     }
61     pr("The current time is   %19.19s.\n\n", ctime(&now));
62
63     if (next && update_window) {
64         pr("The next update window starts at %19.19s.\n",
65            ctime(&next));
66         stop = next + update_window;
67         pr("The next update window stops at %19.19s.\n", ctime(&stop));
68     }
69
70     switch (update_demand) {
71     case UPD_DEMAND_NONE:
72     default:
73         break;
74     case UPD_DEMAND_SCHED:
75         pr("Demand updates occur at update CHECK times.\n");
76         if (next) {
77             pr("The next update check is at %19.19s.\n",
78                ctime(&next));
79         }
80         pr("Demand updates require %d country(s) to want one.\n",
81            update_wantmin);
82         break;
83     case UPD_DEMAND_ASYNC:
84         pr("Demand updates occur right after the demand is set.\n");
85         if (*update_demandtimes != 0) {
86             pr("Demand updates are allowed during: %s\n",
87                update_demandtimes);
88         }
89         pr("Demand updates require %d country(s) to want one.\n",
90            update_wantmin);
91     }
92
93     if (*game_days != 0)
94         pr("Game days are: %s\n", game_days);
95     if (*game_hours != 0)
96         pr("Game hours are: %s\n", game_hours);
97
98     pr("\nThis command is obsolete and will go away in a future version.\n"
99        "Please use \"show updates\".\n");
100     return 0;
101 }