| 1 |
root |
1.2 |
/* |
| 2 |
root |
1.13 |
* This file is part of Deliantra, the Roguelike Realtime MMORPG. |
| 3 |
pippijn |
1.7 |
* |
| 4 |
root |
1.17 |
* Copyright (©) 2006,2007,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
| 5 |
root |
1.11 |
* Copyright (©) 2003-2006,2007 Mark Wedel & Crossfire Development Team |
| 6 |
|
|
* Copyright (©) 2000,2007 Tim Rightnour |
| 7 |
|
|
* Copyright (©) 1992,2007 Frank Tore Johansen |
| 8 |
pippijn |
1.7 |
* |
| 9 |
root |
1.18 |
* Deliantra is free software: you can redistribute it and/or modify it under |
| 10 |
|
|
* the terms of the Affero GNU General Public License as published by the |
| 11 |
|
|
* Free Software Foundation, either version 3 of the License, or (at your |
| 12 |
|
|
* option) any later version. |
| 13 |
pippijn |
1.7 |
* |
| 14 |
root |
1.12 |
* This program is distributed in the hope that it will be useful, |
| 15 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
|
|
* GNU General Public License for more details. |
| 18 |
pippijn |
1.7 |
* |
| 19 |
root |
1.18 |
* You should have received a copy of the Affero GNU General Public License |
| 20 |
|
|
* and the GNU General Public License along with this program. If not, see |
| 21 |
|
|
* <http://www.gnu.org/licenses/>. |
| 22 |
root |
1.11 |
* |
| 23 |
root |
1.13 |
* The authors can be reached via e-mail to <support@deliantra.net> |
| 24 |
pippijn |
1.7 |
*/ |
| 25 |
root |
1.1 |
|
| 26 |
root |
1.8 |
#ifndef TOD_H_ |
| 27 |
|
|
#define TOD_H_ |
| 28 |
root |
1.1 |
|
| 29 |
root |
1.9 |
#define TICK (MAX_TIME * 1e-6) |
| 30 |
|
|
|
| 31 |
root |
1.10 |
#define TICK2TIME(tick) (tstamp (tick) * TICK) |
| 32 |
|
|
#define TIME2TICK(time) tstamp ((time) / TICK) |
| 33 |
|
|
|
| 34 |
root |
1.15 |
#define RUNTIME_PER_MINUTE 3. |
| 35 |
|
|
#define RUNTIME_PER_HOUR (RUNTIME_PER_MINUTE * 60.) |
| 36 |
root |
1.8 |
#define TICKS_PER_HOUR int (RUNTIME_PER_HOUR / MAX_TIME * 1e6) |
| 37 |
root |
1.1 |
|
| 38 |
root |
1.16 |
// the first year in the game |
| 39 |
|
|
#define EPOCH 8437 |
| 40 |
|
|
|
| 41 |
root |
1.1 |
/* game time */ |
| 42 |
|
|
#define HOURS_PER_DAY 28 |
| 43 |
root |
1.8 |
#define DAYS_PER_WEEK 7 |
| 44 |
|
|
#define WEEKS_PER_MONTH 5 |
| 45 |
root |
1.1 |
#define MONTHS_PER_YEAR 17 |
| 46 |
|
|
|
| 47 |
root |
1.15 |
// one game minute is 3s |
| 48 |
|
|
// one game hour is 3m |
| 49 |
|
|
// one game day is 1h24s |
| 50 |
|
|
// one game week is 9h48s |
| 51 |
|
|
// one game month is 2d1h |
| 52 |
|
|
// one game year is 34d17h |
| 53 |
|
|
|
| 54 |
root |
1.1 |
/* convenience */ |
| 55 |
root |
1.8 |
#define WEEKS_PER_YEAR (WEEKS_PER_MONTH * MONTHS_PER_YEAR) |
| 56 |
|
|
#define DAYS_PER_MONTH (DAYS_PER_WEEK * WEEKS_PER_MONTH) |
| 57 |
|
|
#define DAYS_PER_YEAR (DAYS_PER_MONTH * MONTHS_PER_YEAR) |
| 58 |
|
|
#define HOURS_PER_WEEK (HOURS_PER_DAY * DAYS_PER_WEEK) |
| 59 |
|
|
#define HOURS_PER_MONTH (HOURS_PER_WEEK * WEEKS_PER_MONTH) |
| 60 |
|
|
#define HOURS_PER_YEAR (HOURS_PER_MONTH * MONTHS_PER_YEAR) |
| 61 |
root |
1.1 |
|
| 62 |
|
|
#define LUNAR_DAYS DAYS_PER_MONTH |
| 63 |
|
|
|
| 64 |
root |
1.8 |
struct timeofday_t |
| 65 |
|
|
{ |
| 66 |
|
|
int year; |
| 67 |
|
|
int month; |
| 68 |
|
|
int day; |
| 69 |
|
|
int dayofweek; |
| 70 |
|
|
int hour; |
| 71 |
|
|
int minute; |
| 72 |
|
|
int weekofmonth; |
| 73 |
|
|
int season; |
| 74 |
|
|
}; |
| 75 |
root |
1.1 |
|
| 76 |
|
|
/* from common/time.c */ |
| 77 |
root |
1.15 |
void get_tod (timeofday_t *tod); |
| 78 |
|
|
char *format_tod (char *buf, int len, timeofday_t *tod); |
| 79 |
|
|
void print_tod (object *op); |
| 80 |
root |
1.1 |
|
| 81 |
root |
1.8 |
#endif |
| 82 |
root |
1.1 |
|