aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-09 22:47:50 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-09 22:47:50 +0200
commit56ae9cf88f9603a780cf6b5cf9b7483cd9d252a2 (patch)
treeb95b6a072f79c01800fd42deb5bc49fed9fcbd8e /FICS
parent9bf7f856804aca90cfb285e1e94ba16b7d42bf2d (diff)
Usage of 'time_t'
Diffstat (limited to 'FICS')
-rw-r--r--FICS/adminproc.c2
-rw-r--r--FICS/command.c17
-rw-r--r--FICS/playerdb.h15
-rw-r--r--FICS/talkproc.c8
4 files changed, 22 insertions, 20 deletions
diff --git a/FICS/adminproc.c b/FICS/adminproc.c
index 7081cad..eb30ff8 100644
--- a/FICS/adminproc.c
+++ b/FICS/adminproc.c
@@ -1500,7 +1500,7 @@ SetRating(int p1, param_list param, statistics *s)
if (s->num == 0) {
s->ltime = 0L;
} else {
- s->ltime = time(0);
+ s->ltime = time(NULL);
}
}
diff --git a/FICS/command.c b/FICS/command.c
index ab6cd27..ee9b8d7 100644
--- a/FICS/command.c
+++ b/FICS/command.c
@@ -846,7 +846,7 @@ process_password(int p, char *password)
player_clear(p);
parray[p].logon_time = parray[p].last_command_time =
- time(0);
+ time(NULL);
parray[p].status = PLAYER_LOGIN;
parray[p].socket = fd;
parray[p].thisHost = fromHost;
@@ -947,9 +947,9 @@ process_password(int p, char *password)
parray[p].lastHost = parray[p].thisHost;
if (parray[p].registered && !parray[p].timeOfReg)
- parray[p].timeOfReg = time(0);
+ parray[p].timeOfReg = time(NULL);
- parray[p].logon_time = parray[p].last_command_time = time(0);
+ parray[p].logon_time = parray[p].last_command_time = time(NULL);
dummy = check_and_print_shutdown(p); // Tells the user if we are
// going to shutdown
@@ -1054,7 +1054,7 @@ process_input(int fd, char *com_string)
}
commanding_player = p;
- parray[p].last_command_time = time(0);
+ parray[p].last_command_time = time(NULL);
switch (parray[p].status) {
case PLAYER_EMPTY:
@@ -1101,7 +1101,7 @@ process_new_connection(int fd, unsigned int fromHost)
parray[p].status = PLAYER_LOGIN;
parray[p].socket = fd;
parray[p].thisHost = fromHost;
- parray[p].logon_time = time(0);
+ parray[p].logon_time = time(NULL);
psend_raw_file(p, mess_dir, MESS_WELCOME);
pprintf(p, "Head admin : %s Complaints to : %s\n",
@@ -1148,7 +1148,8 @@ process_disconnection(int fd)
player_write_logout(p);
if (parray[p].registered) {
- parray[p].totalTime += time(0) - parray[p].logon_time;
+ parray[p].totalTime += (time(NULL) -
+ parray[p].logon_time);
player_save(p);
} else { // delete unreg history file
char fname[MAX_FILENAME_SIZE] = { '\0' };
@@ -1170,7 +1171,7 @@ process_disconnection(int fd)
PUBLIC int
process_heartbeat(int *fd)
{
- int now = time(0);
+ time_t now = time(NULL);
int time_since_last;
static int last_comfile = 0;
static int last_space = 0;
@@ -1303,7 +1304,7 @@ TerminateCleanup(void)
player_write_logout(p1);
if (parray[p1].registered) {
parray[p1].totalTime +=
- (time(0) - parray[p1].logon_time);
+ (time(NULL) - parray[p1].logon_time);
}
player_save(p1);
}
diff --git a/FICS/playerdb.h b/FICS/playerdb.h
index 6eaf1e7..5d1a55d 100644
--- a/FICS/playerdb.h
+++ b/FICS/playerdb.h
@@ -59,8 +59,9 @@
#define SORT_WILD 3
typedef struct _statistics {
- int num, win, los, dra, rating, ltime, best, whenbest;
double sterr;
+ int num, win, los, dra, rating, best, whenbest;
+ time_t ltime;
} statistics;
#define PEND_MATCH 0
@@ -109,12 +110,12 @@ typedef struct _player {
int kiblevel;
int lastColor;
int last_channel;
- int last_command_time;
+ time_t last_command_time;
int last_opponent;
int last_tell;
- int lastshout_a;
- int lastshout_b;
- int logon_time;
+ time_t lastshout_a;
+ time_t lastshout_b;
+ time_t logon_time;
int num_comments; // number of lines in comments file
int num_from;
int num_observe;
@@ -127,8 +128,8 @@ typedef struct _player {
int socket;
int sopen;
int status;
- int timeOfReg;
- int totalTime;
+ time_t timeOfReg;
+ time_t totalTime;
long last_file_byte;
pending p_from_list[MAX_PENDING];
pending p_to_list[MAX_PENDING];
diff --git a/FICS/talkproc.c b/FICS/talkproc.c
index 635a1a3..275ac3b 100644
--- a/FICS/talkproc.c
+++ b/FICS/talkproc.c
@@ -64,8 +64,8 @@ int quota_time;
PRIVATE int
CheckShoutQuota(int p)
{
- int timeleft = 0;
- int timenow = time(0);
+ time_t timeleft = 0;
+ time_t timenow = time(NULL);
timeleft = timenow - parray[p].lastshout_a;
@@ -110,7 +110,7 @@ com_shout(int p, param_list param)
}
parray[p].lastshout_a = parray[p].lastshout_b;
- parray[p].lastshout_b = time(0);
+ parray[p].lastshout_b = time(NULL);
if (!printablestring(param[0].val.string)) {
pprintf(p, "Your message contains some unprintable "
@@ -226,7 +226,7 @@ com_it(int p, param_list param)
}
parray[p].lastshout_a = parray[p].lastshout_b;
- parray[p].lastshout_b = time(0);
+ parray[p].lastshout_b = time(NULL);
if (!printablestring(param[0].val.string)) {
pprintf(p, "Your message contains some unprintable "