Skip to content

Commit df22f3a

Browse files
ChatAdditions.inc: get seconds const from time.inc (#285)
Fix #276
1 parent 5f27eb5 commit df22f3a

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

cstrike/addons/amxmodx/scripting/include/ChatAdditions.inc

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#define CA_VERSION "%CA_VERSION%"
2020
#endif
2121

22+
#if !defined _time_included
23+
#include <time>
24+
#endif
25+
2226
const CA_MAX_MESSAGE_SIZE = 188
2327

2428
/**
@@ -62,13 +66,6 @@ new stock const BASE_CHAT_TRIGGERS[][] = { /* "", */"/", "\", "!", "." };
6266

6367

6468
stock parseTime(const value[]) {
65-
const _SECONDS_IN_MINUTE = 60;
66-
const _SECONDS_IN_HOUR = 3600;
67-
const _SECONDS_IN_DAY = 86400;
68-
const _SECONDS_IN_WEEK = 604800;
69-
const _SECONDS_IN_MONTH = _SECONDS_IN_DAY * 31;
70-
const _SECONDS_IN_YEAR = _SECONDS_IN_MONTH * 12;
71-
7269
new t, k;
7370
for (new i; value[i] != EOS; i++) {
7471
switch (value[i]) {
@@ -77,32 +74,32 @@ stock parseTime(const value[]) {
7774
}
7875

7976
case 'i': {
80-
k += t * _SECONDS_IN_MINUTE;
77+
k += t * SECONDS_IN_MINUTE;
8178
t = 0;
8279
}
8380

8481
case 'h': {
85-
k += t * _SECONDS_IN_HOUR;
82+
k += t * SECONDS_IN_HOUR;
8683
t = 0;
8784
}
8885

8986
case 'd': {
90-
k += t * _SECONDS_IN_DAY;
87+
k += t * SECONDS_IN_DAY;
9188
t = 0;
9289
}
9390

9491
case 'w': {
95-
k += t * _SECONDS_IN_WEEK;
92+
k += t * SECONDS_IN_WEEK;
9693
t = 0;
9794
}
9895

9996
case 'm': {
100-
k += t * _SECONDS_IN_MONTH;
97+
k += t * SECONDS_IN_MONTH;
10198
t = 0;
10299
}
103100

104101
case 'y': {
105-
k += t * _SECONDS_IN_YEAR;
102+
k += t * SECONDS_IN_YEAR;
106103
t = 0;
107104
}
108105

0 commit comments

Comments
 (0)