]> git.pond.sub.org Git - empserver/blob - src/scripts/nightly/patches/All/emptime.c.patch
License upgrade to GPL version 3 or later
[empserver] / src / scripts / nightly / patches / All / emptime.c.patch
1 diff --git a/include/emptime.h b/include/emptime.h
2 new file mode 100644
3 index 0000000..a83b29d
4 --- /dev/null
5 +++ b/include/emptime.h
6 @@ -0,0 +1,40 @@
7 +/*
8 + *  Empire - A multi-player, client/server Internet based war game.
9 + *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
10 + *                Ken Stevens, Steve McClure, Markus Armbruster
11 + *
12 + *  Empire is free software: you can redistribute it and/or modify
13 + *  it under the terms of the GNU General Public License as published by
14 + *  the Free Software Foundation, either version 3 of the License, or
15 + *  (at your option) any later version.
16 + *
17 + *  This program is distributed in the hope that it will be useful,
18 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
19 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 + *  GNU General Public License for more details.
21 + *
22 + *  You should have received a copy of the GNU General Public License
23 + *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
24 + *
25 + *  ---
26 + *
27 + *  See files README, COPYING and CREDITS in the root of the source
28 + *  tree for related information and legal notices.  It is expected
29 + *  that future projects/authors will amend these files as needed.
30 + *
31 + *  ---
32 + *
33 + *  emptime.h: Time functions for regression testing and
34 + *             replaying journals.
35 + *
36 + *  Known contributors to this file:
37 + *     Ron Koenderink, 2008
38 + */
39 +
40 +#ifndef EMPTIME_H
41 +#define EMPTIME_H
42 +
43 +#include <time.h>
44 +
45 +extern time_t emp_time(time_t *, const char []);
46 +#endif
47 diff --git a/src/lib/gen/emptime.c b/src/lib/gen/emptime.c
48 new file mode 100644
49 index 0000000..855de99
50 --- /dev/null
51 +++ b/src/lib/gen/emptime.c
52 @@ -0,0 +1,50 @@
53 +/*
54 + *  Empire - A multi-player, client/server Internet based war game.
55 + *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
56 + *                Ken Stevens, Steve McClure, Markus Armbruster
57 + *
58 + *  Empire is free software: you can redistribute it and/or modify
59 + *  it under the terms of the GNU General Public License as published by
60 + *  the Free Software Foundation, either version 3 of the License, or
61 + *  (at your option) any later version.
62 + *
63 + *  This program is distributed in the hope that it will be useful,
64 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
65 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
66 + *  GNU General Public License for more details.
67 + *
68 + *  You should have received a copy of the GNU General Public License
69 + *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
70 + *
71 + *  ---
72 + *
73 + *  See files README, COPYING and CREDITS in the root of the source
74 + *  tree for related information and legal notices.  It is expected
75 + *  that future projects/authors will amend these files as needed.
76 + *
77 + *  ---
78 + *
79 + *  emptime.c: Time functions for regression testing and
80 + *             replaying journals.
81 + *
82 + *  Known contributors to this file:
83 + *     Ron Koenderink, 2008
84 + */
85 +
86 +#include <stdio.h>
87 +#include <string.h>
88 +#include "emptime.h"
89 +
90 +time_t
91 +emp_time(time_t * time_ptr, const char function[])
92 +{
93 +    static time_t now = (time_t)100L;
94 +
95 +    if (strcmp(function, "update_main") == 0)
96 +       now += 100L;
97 +
98 +    if (time_ptr != NULL)
99 +       *time_ptr = now;
100 +
101 +    return now;
102 +}