From 4a2c9aa9ab119a212d78c6a3a73261de56800251 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Sat, 5 Jan 2008 12:22:03 -0500 Subject: [PATCH] Convert time-related variables to consistently use "unsigned long". configure.in: Remove no-longer-used check for FMT_TIME_T. src/*.c: Convert time_t and time adjustment values to unsigned long. src/*.h: Likewise. src/config.h.win32: Remove definition of FMT_TIME_T. --- configure.in | 26 ---------------- src/chanserv.c | 75 ++++++++++++++++++++++++--------------------- src/chanserv.h | 23 ++++++++------ src/checkdb.c | 6 ++-- src/common.h | 4 +-- src/config.h.win32 | 3 -- src/gline.c | 8 ++--- src/gline.h | 16 +++++----- src/global.c | 14 ++++----- src/hash.c | 6 ++-- src/hash.h | 25 +++++++-------- src/heap.c | 4 +-- src/heap.h | 2 +- src/ioset-select.c | 4 +-- src/ioset.c | 4 +-- src/log.c | 8 +++-- src/log.h | 10 +++--- src/main-common.c | 8 +++-- src/main.c | 7 +++-- src/mod-helpserv.c | 75 ++++++++++++++++++++++++++------------------- src/mod-memoserv.c | 21 ++++++------- src/mod-snoop.c | 3 +- src/mod-sockcheck.c | 17 +++++----- src/modcmd.c | 14 ++++----- src/nickserv.c | 22 +++++++------ src/nickserv.h | 10 +++--- src/opserv.c | 53 +++++++++++++++++--------------- src/opserv.h | 2 +- src/proto-bahamut.c | 39 +++++++++++------------ src/proto-common.c | 9 +++--- src/proto-p10.c | 70 ++++++++++++++++++++++-------------------- src/proto.h | 4 +-- src/sar.c | 6 ++-- src/sar.h | 2 +- src/saxdb.c | 8 ++--- src/timeq.c | 16 +++++----- src/timeq.h | 6 ++-- src/tools.c | 4 +-- 38 files changed, 321 insertions(+), 313 deletions(-) diff --git a/configure.in b/configure.in index 31c82aa..9a154d7 100644 --- a/configure.in +++ b/configure.in @@ -141,32 +141,6 @@ fi dnl Check for post-C89 keywords AC_C_INLINE -dnl Now figure out how to printf() a time_t -AC_MSG_CHECKING(for time_t format) -AC_CACHE_VAL(ac_cv_fmt_time_t, [ -ac_cv_fmt_time_t=no -AC_COMPILE_IFELSE([#include -#include -void myfunc(void) { - time_t test=0; - printf("%li", test); -}], ac_cv_fmt_time_t="\"%li\"") -if test $ac_cv_fmt_time_t = no; then -AC_COMPILE_IFELSE([#include -#include -void myfunc(void) { - time_t test=0; - printf("%i", test); -}], ac_cv_fmt_time_t="\"%i\"") -fi -if test $ac_cv_fmt_time_t = no; then -AC_MSG_ERROR([Cannot detect format string for time_t -Please check sys/types.h for the typedef of time_t and submit to a developer]) -fi -]) -AC_DEFINE_UNQUOTED(FMT_TIME_T, $ac_cv_fmt_time_t, [Define to printf format for a time_t variable]) -AC_MSG_RESULT($ac_cv_fmt_time_t) - dnl How to copy one va_list to another? AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy, [AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [va_list ap1, ap2; va_copy(ap1, ap2);])], diff --git a/src/chanserv.c b/src/chanserv.c index ec6a364..9ad4cd4 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -497,9 +497,9 @@ static struct unsigned long channel_expire_frequency; unsigned long dnr_expire_frequency; - long info_delay; - unsigned int adjust_delay; - long channel_expire_delay; + unsigned long info_delay; + unsigned long adjust_delay; + unsigned long channel_expire_delay; unsigned int nodelete_level; unsigned int adjust_threshold; @@ -1115,7 +1115,7 @@ register_channel(struct chanNode *cNode, char *registrar) } static struct userData* -add_channel_user(struct chanData *channel, struct handle_info *handle, unsigned short access, time_t seen, const char *info) +add_channel_user(struct chanData *channel, struct handle_info *handle, unsigned short access, unsigned long seen, const char *info) { struct userData *ud; @@ -1180,7 +1180,7 @@ del_channel_user(struct userData *user, int do_gc) static void expire_ban(void *data); static struct banData* -add_channel_ban(struct chanData *channel, const char *mask, char *owner, time_t set, time_t triggered, time_t expires, char *reason) +add_channel_ban(struct chanData *channel, const char *mask, char *owner, unsigned long set, unsigned long triggered, unsigned long expires, char *reason) { struct banData *bd; unsigned int ii, l1, l2; @@ -1506,7 +1506,7 @@ validate_deop(struct userNode *user, struct chanNode *channel, struct userNode * } static struct do_not_register * -chanserv_add_dnr(const char *chan_name, const char *setter, time_t expires, const char *reason) +chanserv_add_dnr(const char *chan_name, const char *setter, unsigned long expires, const char *reason) { struct do_not_register *dnr = calloc(1, sizeof(*dnr)+strlen(reason)); safestrncpy(dnr->chan_name, chan_name, sizeof(dnr->chan_name)); @@ -1571,13 +1571,18 @@ static int dnr_print_func(struct do_not_register *dnr, void *extra) struct userNode *user; char buf1[INTERVALLEN]; char buf2[INTERVALLEN]; + time_t feh; user = extra; if(dnr->set) - strftime(buf1, sizeof(buf1), "%d %b %Y", localtime(&dnr->set)); + { + feh = dnr->set; + strftime(buf1, sizeof(buf1), "%d %b %Y", localtime(&feh)); + } if(dnr->expires) { - strftime(buf2, sizeof(buf2), "%d %b %Y", localtime(&dnr->expires)); + feh = dnr->expires; + strftime(buf2, sizeof(buf2), "%d %b %Y", localtime(&feh)); send_message(user, chanserv, "CSMSG_DNR_INFO_SET_EXPIRES", dnr->chan_name, buf1, dnr->setter, buf2, dnr->reason); } else if(dnr->set) @@ -1641,7 +1646,7 @@ static unsigned int send_dnrs(struct userNode *user, dict_t dict) static CHANSERV_FUNC(cmd_noregister) { const char *target; - time_t expiry, duration; + unsigned long expiry, duration; unsigned int matches; if(argc < 2) @@ -1724,8 +1729,8 @@ struct dnr_search { char *chan_mask; char *setter_mask; char *reason_mask; - time_t min_set, max_set; - time_t min_expires, max_expires; + unsigned long min_set, max_set; + unsigned long min_expires, max_expires; unsigned int limit; }; @@ -2768,7 +2773,7 @@ cmd_trim_bans(struct userNode *user, struct chanNode *channel, unsigned long dur struct banData *bData, *next; char interval[INTERVALLEN]; unsigned int count; - time_t limit; + unsigned long limit; count = 0; limit = now - duration; @@ -2794,7 +2799,7 @@ cmd_trim_users(struct userNode *user, struct chanNode *channel, unsigned short m struct userData *actor, *uData, *next; char interval[INTERVALLEN]; unsigned int count; - time_t limit; + unsigned long limit; actor = GetChannelAccess(channel->channel_info, user->handle_info); if(min_access > max_access) @@ -3242,7 +3247,7 @@ eject_user(struct userNode *user, struct chanNode *channel, unsigned int argc, c /* If the ban matches an existing one exactly, extend the expiration time if the provided duration is longer. */ - if(duration && ((time_t)(now + duration) > bData->expires)) + if(duration && (now + duration > bData->expires)) { bData->expires = now + duration; reset = 1; @@ -4401,7 +4406,7 @@ static CHANSERV_FUNC(cmd_info) static CHANSERV_FUNC(cmd_netinfo) { - extern time_t boot_time; + extern unsigned long boot_time; extern unsigned long burst_length; char interval[INTERVALLEN]; @@ -4913,7 +4918,7 @@ static CHANSERV_FUNC(cmd_csuspend) { struct suspended *suspended; char reason[MAXLEN]; - time_t expiry, duration; + unsigned long expiry, duration; struct userData *uData; REQUIRE_PARAMS(3); @@ -5015,8 +5020,8 @@ typedef struct chanservSearch char *name; char *registrar; - time_t unvisited; - time_t registered; + unsigned long unvisited; + unsigned long registered; unsigned long flags; unsigned int limit; @@ -5171,7 +5176,7 @@ static CHANSERV_FUNC(cmd_search) static CHANSERV_FUNC(cmd_unvisited) { struct chanData *cData; - time_t interval = chanserv_conf.channel_expire_delay; + unsigned long interval = chanserv_conf.channel_expire_delay; char buffer[INTERVALLEN]; unsigned int limit = 25, matches = 0; @@ -5978,7 +5983,7 @@ static CHANSERV_FUNC(cmd_giveownership) } curr_user = owner; } - else if(!force && (now < (time_t)(cData->ownerTransfer + chanserv_conf.giveownership_period))) + else if(!force && (now < cData->ownerTransfer + chanserv_conf.giveownership_period)) { char delay[INTERVALLEN]; intervalString(delay, cData->ownerTransfer + chanserv_conf.giveownership_period - now, user->handle_info); @@ -7083,7 +7088,7 @@ user_read_helper(const char *key, struct record_data *rd, struct chanData *chan) struct handle_info *handle; struct userData *uData; char *seen, *inf, *flags; - time_t last_seen; + unsigned long last_seen; unsigned short access; if(rd->type != RECDB_OBJECT || !dict_size(rd->d.object)) @@ -7101,7 +7106,7 @@ user_read_helper(const char *key, struct record_data *rd, struct chanData *chan) inf = database_get_data(rd->d.object, KEY_INFO, RECDB_QSTRING); seen = database_get_data(rd->d.object, KEY_SEEN, RECDB_QSTRING); - last_seen = seen ? (signed)strtoul(seen, NULL, 0) : now; + last_seen = seen ? strtoul(seen, NULL, 0) : now; flags = database_get_data(rd->d.object, KEY_FLAGS, RECDB_QSTRING); handle = get_handle_info(key); if(!handle) @@ -7119,7 +7124,7 @@ ban_read_helper(const char *key, struct record_data *rd, struct chanData *chan) { struct banData *bData; char *set, *triggered, *s_duration, *s_expires, *reason, *owner; - time_t set_time, triggered_time, expires_time; + unsigned long set_time, triggered_time, expires_time; if(rd->type != RECDB_OBJECT || !dict_size(rd->d.object)) { @@ -7136,10 +7141,10 @@ ban_read_helper(const char *key, struct record_data *rd, struct chanData *chan) if (!reason || !owner) return; - set_time = set ? (time_t)strtoul(set, NULL, 0) : now; - triggered_time = triggered ? (time_t)strtoul(triggered, NULL, 0) : 0; + set_time = set ? strtoul(set, NULL, 0) : now; + triggered_time = triggered ? strtoul(triggered, NULL, 0) : 0; if(s_expires) - expires_time = (time_t)strtoul(s_expires, NULL, 0); + expires_time = strtoul(s_expires, NULL, 0); else if(s_duration) expires_time = set_time + atoi(s_duration); else @@ -7159,11 +7164,11 @@ chanserv_read_suspended(dict_t obj) dict_t previous; str = database_get_data(obj, KEY_EXPIRES, RECDB_QSTRING); - suspended->expires = str ? (time_t)strtoul(str, NULL, 0) : 0; + suspended->expires = str ? strtoul(str, NULL, 0) : 0; str = database_get_data(obj, KEY_REVOKED, RECDB_QSTRING); - suspended->revoked = str ? (time_t)strtoul(str, NULL, 0) : 0; + suspended->revoked = str ? strtoul(str, NULL, 0) : 0; str = database_get_data(obj, KEY_ISSUED, RECDB_QSTRING); - suspended->issued = str ? (time_t)strtoul(str, NULL, 0) : 0; + suspended->issued = str ? strtoul(str, NULL, 0) : 0; suspended->suspender = strdup(database_get_data(obj, KEY_SUSPENDER, RECDB_QSTRING)); suspended->reason = strdup(database_get_data(obj, KEY_REASON, RECDB_QSTRING)); previous = database_get_data(obj, KEY_PREVIOUS, RECDB_OBJECT); @@ -7309,11 +7314,11 @@ chanserv_channel_read(const char *key, struct record_data *hir) } str = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING); - cData->registered = str ? (time_t)strtoul(str, NULL, 0) : now; + cData->registered = str ? strtoul(str, NULL, 0) : now; str = database_get_data(channel, KEY_VISITED, RECDB_QSTRING); - cData->visited = str ? (time_t)strtoul(str, NULL, 0) : now; + cData->visited = str ? strtoul(str, NULL, 0) : now; str = database_get_data(channel, KEY_OWNER_TRANSFER, RECDB_QSTRING); - cData->ownerTransfer = str ? (time_t)strtoul(str, NULL, 0) : 0; + cData->ownerTransfer = str ? strtoul(str, NULL, 0) : 0; str = database_get_data(channel, KEY_MAX, RECDB_QSTRING); cData->max = str ? atoi(str) : 0; str = database_get_data(channel, KEY_GREETING, RECDB_QSTRING); @@ -7388,7 +7393,7 @@ chanserv_dnr_read(const char *key, struct record_data *hir) { const char *setter, *reason, *str; struct do_not_register *dnr; - time_t expiry; + unsigned long expiry; setter = database_get_data(hir->d.object, KEY_DNR_SETTER, RECDB_QSTRING); if(!setter) @@ -7403,7 +7408,7 @@ chanserv_dnr_read(const char *key, struct record_data *hir) return; } str = database_get_data(hir->d.object, KEY_EXPIRES, RECDB_QSTRING); - expiry = str ? (time_t)strtoul(str, NULL, 0) : 0; + expiry = str ? strtoul(str, NULL, 0) : 0; if(expiry && expiry <= now) return; dnr = chanserv_add_dnr(key, setter, expiry, reason); @@ -7870,7 +7875,7 @@ init_chanserv(const char *nick) if(chanserv_conf.refresh_period) { - time_t next_refresh; + unsigned long next_refresh; next_refresh = (now + chanserv_conf.refresh_period - 1) / chanserv_conf.refresh_period * chanserv_conf.refresh_period; timeq_add(next_refresh, chanserv_refresh_topics, NULL); } diff --git a/src/chanserv.h b/src/chanserv.h index dddc712..a84a86c 100644 --- a/src/chanserv.h +++ b/src/chanserv.h @@ -79,10 +79,10 @@ struct chanData struct chanNode *channel; struct mod_chanmode modes; - time_t registered; - time_t visited; - time_t limitAdjusted; - time_t ownerTransfer; + unsigned long registered; + unsigned long visited; + unsigned long limitAdjusted; + unsigned long ownerTransfer; char *topic; char *greeting; @@ -122,7 +122,7 @@ struct userData struct chanData *channel; char *info; - time_t seen; + unsigned long seen; unsigned short access; unsigned int present : 1; unsigned int flags : USER_FLAGS_SIZE; @@ -141,9 +141,9 @@ struct banData char owner[NICKLEN+1]; struct chanData *channel; - time_t set; - time_t triggered; - time_t expires; + unsigned long set; + unsigned long triggered; + unsigned long expires; char *reason; @@ -156,7 +156,9 @@ struct suspended struct chanData *cData; char *suspender; char *reason; - time_t issued, expires, revoked; + unsigned long issued; + unsigned long expires; + unsigned long revoked; struct suspended *previous; }; @@ -164,7 +166,8 @@ struct do_not_register { char chan_name[CHANNELLEN+1]; char setter[NICKSERV_HANDLE_LEN+1]; - time_t set, expires; + unsigned long set; + unsigned long expires; char reason[1]; }; diff --git a/src/checkdb.c b/src/checkdb.c index 87e38d4..f967748 100644 --- a/src/checkdb.c +++ b/src/checkdb.c @@ -18,7 +18,7 @@ void log_module(UNUSED_ARG(struct log_type *lt), UNUSED_ARG(enum log_severity ls /* and because saxdb is tied in to lots of stuff.. */ -time_t now; +unsigned long now; void *conf_get_data(UNUSED_ARG(const char *full_path), UNUSED_ARG(enum recdb_type type)) { return NULL; @@ -30,10 +30,10 @@ void conf_register_reload(UNUSED_ARG(conf_reload_func crf)) { void reg_exit_func(UNUSED_ARG(exit_func_t handler)) { } -void timeq_add(UNUSED_ARG(time_t when), UNUSED_ARG(timeq_func func), UNUSED_ARG(void *data)) { +void timeq_add(UNUSED_ARG(unsigned long when), UNUSED_ARG(timeq_func func), UNUSED_ARG(void *data)) { } -void timeq_del(UNUSED_ARG(time_t when), UNUSED_ARG(timeq_func func), UNUSED_ARG(void *data), UNUSED_ARG(int mask)) { +void timeq_del(UNUSED_ARG(unsigned long when), UNUSED_ARG(timeq_func func), UNUSED_ARG(void *data), UNUSED_ARG(int mask)) { } int send_message(UNUSED_ARG(struct userNode *dest), UNUSED_ARG(struct userNode *src), UNUSED_ARG(const char *message), ...) { diff --git a/src/common.h b/src/common.h index c23597c..09bc4d1 100644 --- a/src/common.h +++ b/src/common.h @@ -119,7 +119,7 @@ extern void verify(const void *ptr); # define verify(ptr) (void)(ptr) #endif -extern time_t now; +extern unsigned long now; extern int quit_services; extern struct log_type *MAIN_LOG; extern const char git_version[]; @@ -239,7 +239,7 @@ void STRUCTNAME##_clean(struct STRUCTNAME *list) {\ #define INTERVALLEN 50 struct handle_info; -char *intervalString(char *output, time_t interval, struct handle_info *hi); +char *intervalString(char *output, unsigned long interval, struct handle_info *hi); int getipbyname(const char *name, unsigned long *ip); int set_policer_param(const char *param, void *data, void *extra); const char *strtab(unsigned int ii); diff --git a/src/config.h.win32 b/src/config.h.win32 index ddc8520..eabe16f 100644 --- a/src/config.h.win32 +++ b/src/config.h.win32 @@ -24,9 +24,6 @@ /* Define if tokenized P10 desired */ #define ENABLE_TOKENS 1 -/* Define to printf format for a time_t variable */ -#define FMT_TIME_T "%ld" - /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 diff --git a/src/gline.c b/src/gline.c index d9a99c5..3ca7e1a 100644 --- a/src/gline.c +++ b/src/gline.c @@ -93,7 +93,7 @@ delete_gline_for_p(UNUSED_ARG(void *key), void *data, void *extra) static void gline_expire(UNUSED_ARG(void *data)) { - time_t stopped; + unsigned long stopped; void *wraa; stopped = 0; @@ -135,7 +135,7 @@ gline_remove(const char *target, int announce) } struct gline * -gline_add(const char *issuer, const char *target, unsigned long duration, const char *reason, time_t issued, time_t lastmod, int announce) +gline_add(const char *issuer, const char *target, unsigned long duration, const char *reason, unsigned long issued, unsigned long lastmod, int announce) { struct gline *ent; struct gline *prev_first; @@ -146,7 +146,7 @@ gline_add(const char *issuer, const char *target, unsigned long duration, const ent = dict_find(gline_dict, target, NULL); if (ent) { heap_remove_pred(gline_heap, gline_for_p, (char*)target); - if (ent->expires < (time_t)(now + duration)) + if (ent->expires < now + duration) ent->expires = now + duration; if (ent->lastmod < lastmod) ent->lastmod = lastmod; @@ -255,7 +255,7 @@ gline_add_record(const char *key, void *data, UNUSED_ARG(void *extra)) { struct record_data *rd = data; const char *issuer, *reason, *dstr; - time_t issued, expiration, lastmod; + unsigned long issued, expiration, lastmod; if (!(reason = database_get_data(rd->d.object, KEY_REASON, RECDB_QSTRING))) { log_module(MAIN_LOG, LOG_ERROR, "Missing reason for gline %s", key); diff --git a/src/gline.h b/src/gline.h index 9ad30fe..d81a2e6 100644 --- a/src/gline.h +++ b/src/gline.h @@ -24,9 +24,9 @@ #include "hash.h" struct gline { - time_t issued; - time_t lastmod; - time_t expires; + unsigned long issued; + unsigned long lastmod; + unsigned long expires; char *issuer; char *target; char *reason; @@ -39,14 +39,14 @@ struct gline_discrim { char *target_mask; char *alt_target_mask; char *reason_mask; - time_t max_issued; - time_t min_expire; - time_t min_lastmod; - time_t max_lastmod; + unsigned long max_issued; + unsigned long min_expire; + unsigned long min_lastmod; + unsigned long max_lastmod; }; void gline_init(void); -struct gline *gline_add(const char *issuer, const char *target, unsigned long duration, const char *reason, time_t issued, time_t lastmod, int announce); +struct gline *gline_add(const char *issuer, const char *target, unsigned long duration, const char *reason, unsigned long issued, unsigned long lastmod, int announce); struct gline *gline_find(const char *target); int gline_remove(const char *target, int announce); void gline_refresh_server(struct server *srv); diff --git a/src/global.c b/src/global.c index d904b08..69ab616 100644 --- a/src/global.c +++ b/src/global.c @@ -69,7 +69,7 @@ struct globalMessage unsigned long id; long flags; - time_t posted; + unsigned long posted; char posted_s[24]; unsigned long duration; @@ -86,7 +86,7 @@ static struct module *global_module; static struct service *global_service; static struct globalMessage *messageList; static long messageCount; -static time_t last_max_alert; +static unsigned long last_max_alert; static struct log_type *G_LOG; static struct @@ -99,10 +99,10 @@ static struct void message_expire(void *data); static struct globalMessage* -message_add(long flags, time_t posted, unsigned long duration, char *from, const char *msg) +message_add(long flags, unsigned long posted, unsigned long duration, char *from, const char *msg) { struct globalMessage *message; - struct tm tm; + time_t feh; message = malloc(sizeof(struct globalMessage)); if(!message) @@ -118,9 +118,9 @@ message_add(long flags, time_t posted, unsigned long duration, char *from, const message->message = strdup(msg); if ((flags & MESSAGE_OPTION_IMMEDIATE) == 0) { - localtime_r(&message->posted, &tm); + feh = message->posted; strftime(message->posted_s, sizeof(message->posted_s), - "%I:%M %p, %m/%d/%Y", &tm); + "%I:%M %p, %m/%d/%Y", localtime(&feh)); } if(messageList) @@ -599,7 +599,7 @@ static int global_saxdb_read(struct dict *db) { struct record_data *hir; - time_t posted; + unsigned long posted; long flags; unsigned long duration; char *str, *from, *message; diff --git a/src/hash.c b/src/hash.c index 2250d06..4fa1e91 100644 --- a/src/hash.c +++ b/src/hash.c @@ -28,7 +28,7 @@ dict_t channels; dict_t clients; dict_t servers; unsigned int max_clients, invis_clients; -time_t max_clients_time; +unsigned long max_clients_time; struct userList curr_opers; static void hash_cleanup(void); @@ -297,7 +297,7 @@ reg_join_func(join_func_t handler) int rel_age; static void -wipeout_channel(struct chanNode *cNode, time_t new_time, char **modes, unsigned int modec) { +wipeout_channel(struct chanNode *cNode, unsigned long new_time, char **modes, unsigned int modec) { unsigned int orig_limit; chan_mode_t orig_modes; char orig_key[KEYLEN+1]; @@ -357,7 +357,7 @@ wipeout_channel(struct chanNode *cNode, time_t new_time, char **modes, unsigned } struct chanNode * -AddChannel(const char *name, time_t time_, const char *modes, char *banlist) +AddChannel(const char *name, unsigned long time_, const char *modes, char *banlist) { struct chanNode *cNode; char new_modes[MAXLEN], *argv[MAXNUMPARAMS]; diff --git a/src/hash.h b/src/hash.h index 354054e..e02e0ae 100644 --- a/src/hash.h +++ b/src/hash.h @@ -115,9 +115,9 @@ struct userNode { irc_in_addr_t ip; /* User's IP address */ long modes; /* user flags +isw etc... */ - time_t timestamp; /* Time of last nick change */ - time_t idle_since; - struct server *uplink; /* Server that user is connected to */ + unsigned long timestamp; /* Time of last nick change */ + unsigned long idle_since; /* Last time user did something on or to a channel */ + struct server *uplink; /* Server that user is connected to */ struct modeList channels; /* Vector of channels user is in */ /* from nickserv */ @@ -128,15 +128,16 @@ struct userNode { struct chanNode { chan_mode_t modes; - unsigned int limit, locks; + unsigned int limit; + unsigned int locks; char key[KEYLEN + 1]; char upass[KEYLEN + 1]; char apass[KEYLEN + 1]; - time_t timestamp; /* creation time */ + unsigned long timestamp; /* creation time */ char topic[TOPICLEN + 1]; char topic_nick[NICKLEN + 1]; - time_t topic_time; + unsigned long topic_time; struct modeList members; struct banList banlist; @@ -152,7 +153,7 @@ struct chanNode { struct banNode { char ban[NICKLEN + USERLEN + HOSTLEN + 3]; /* 1 for '\0', 1 for ! and 1 for @ = 3 */ char who[NICKLEN + 1]; /* who set ban */ - time_t set; /* time ban was set */ + unsigned long set; /* time ban was set */ }; struct modeNode { @@ -160,7 +161,7 @@ struct modeNode { struct userNode *user; unsigned short modes; short oplevel; - time_t idle_since; + unsigned long idle_since; }; #define SERVERNAMEMAX 64 @@ -168,8 +169,8 @@ struct modeNode { struct server { char name[SERVERNAMEMAX+1]; - time_t boot; - time_t link; + unsigned long boot; + unsigned long link; char description[SERVERDESCRIPTMAX+1]; #ifdef WITH_PROTOCOL_P10 char numeric[COMBO_NUMERIC_LEN+1]; @@ -191,7 +192,7 @@ extern dict_t channels; extern dict_t clients; extern dict_t servers; extern unsigned int max_clients, invis_clients; -extern time_t max_clients_time; +extern unsigned long max_clients_time; extern struct userList curr_opers, curr_helpers; struct server* GetServerH(const char *name); /* using full name */ @@ -227,7 +228,7 @@ void reg_join_func(join_func_t handler); typedef void (*del_channel_func_t) (struct chanNode *chan); void reg_del_channel_func(del_channel_func_t handler); -struct chanNode* AddChannel(const char *name, time_t time_, const char *modes, char *banlist); +struct chanNode* AddChannel(const char *name, unsigned long time_, const char *modes, char *banlist); void LockChannel(struct chanNode *channel); void UnlockChannel(struct chanNode *channel); diff --git a/src/heap.c b/src/heap.c index 28ed962..dce909a 100644 --- a/src/heap.c +++ b/src/heap.c @@ -210,7 +210,7 @@ heap_size(heap_t heap) /* prepackaged comparators */ int -int_comparator(const void *a, const void *b) +ulong_comparator(const void *a, const void *b) { - return (time_t)a-(time_t)b; + return (unsigned long)a-(unsigned long)b; } diff --git a/src/heap.h b/src/heap.h index 8d097e7..44336fb 100644 --- a/src/heap.h +++ b/src/heap.h @@ -38,7 +38,7 @@ int heap_remove_pred(heap_t heap, int (*pred)(void *key, void *data, void *extra /* useful comparators */ /* int strcmp(const char *s1, const char *s2); from can be used */ -int int_comparator(const void*, const void*); +int ulong_comparator(const void*, const void*); int timeval_comparator(const void*, const void*); #endif /* ndef HEAP_H */ diff --git a/src/ioset-select.c b/src/ioset-select.c index 8ece128..86b23f2 100644 --- a/src/ioset-select.c +++ b/src/ioset-select.c @@ -96,9 +96,9 @@ debug_fdsets(const char *msg, int nfds, fd_set *read_fds, fd_set *write_fds, fd_ } gettimeofday(&now, NULL); if (select_timeout) { - log_module(MAIN_LOG, LOG_DEBUG, "%s, at "FMT_TIME_T".%06ld:%s (timeout "FMT_TIME_T".%06ld)", msg, now.tv_sec, now.tv_usec, buf, select_timeout->tv_sec, select_timeout->tv_usec); + log_module(MAIN_LOG, LOG_DEBUG, "%s, at %lu.%06lu:%s (timeout %lu.%06lu)", msg, (unsigned long)now.tv_sec, (unsigned long)now.tv_usec, buf, (unsigned long)select_timeout->tv_sec, (unsigned long)select_timeout->tv_usec); } else { - log_module(MAIN_LOG, LOG_DEBUG, "%s, at "FMT_TIME_T".%06ld:%s (no timeout)", msg, now.tv_sec, now.tv_usec, buf); + log_module(MAIN_LOG, LOG_DEBUG, "%s, at %lu.%06lu:%s (no timeout)", msg, (unsigned long)now.tv_sec, (unsigned long)now.tv_usec, buf); } } #endif diff --git a/src/ioset.c b/src/ioset.c index 4b6225e..84bcf01 100644 --- a/src/ioset.c +++ b/src/ioset.c @@ -577,7 +577,7 @@ void ioset_run(void) { extern struct io_fd *socket_io_fd; struct timeval timeout; - time_t wakey; + unsigned long wakey; while (!quit_services) { while (!socket_io_fd) @@ -585,7 +585,7 @@ ioset_run(void) { /* How long to sleep? (fill in select_timeout) */ wakey = timeq_next(); - if ((wakey - now) < 0) + if (wakey < now) timeout.tv_sec = 0; else timeout.tv_sec = wakey - now; diff --git a/src/log.c b/src/log.c index ad341b8..7368fbe 100644 --- a/src/log.c +++ b/src/log.c @@ -527,7 +527,7 @@ log_audit(struct log_type *type, enum log_severity sev, struct userNode *user, s /* remove old elements from the linked list */ while (type->log_count > type->max_count) log_type_free_oldest(type); - while (type->log_oldest && (type->log_oldest->time + (time_t)type->max_age < now)) + while (type->log_oldest && (type->log_oldest->time + type->max_age < now)) log_type_free_oldest(type); if (type->log_oldest) type->log_oldest->prev = 0; @@ -753,10 +753,12 @@ log_entry_search(struct logSearch *discrim, entry_search_func esf, void *data) /* generic helper functions */ static void -log_format_timestamp(time_t when, struct string_buffer *sbuf) +log_format_timestamp(unsigned long when, struct string_buffer *sbuf) { struct tm local; - localtime_r(&when, &local); + time_t feh; + feh = when; + localtime_r(&feh, &local); if (sbuf->size < 24) { sbuf->size = 24; free(sbuf->list); diff --git a/src/log.h b/src/log.h index bc72686..8493e76 100644 --- a/src/log.h +++ b/src/log.h @@ -57,15 +57,15 @@ void log_replay(struct log_type *type, int is_write, const char *line); struct logEntry { /* field nullable in real entries? */ - time_t time; - enum log_severity slvl; + unsigned long time; /* no */ + enum log_severity slvl; /* no */ struct userNode *bot; /* no */ char *channel_name; /* yes */ char *user_nick; /* no */ char *user_account; /* yes */ char *user_hostmask; /* yes */ char *command; /* no */ - char *default_desc; + char *default_desc; /* no */ struct logEntry *next; struct logEntry *prev; }; @@ -74,8 +74,8 @@ struct logSearch { struct logEntry masks; struct log_type *type; - time_t min_time; - time_t max_time; + unsigned long min_time; + unsigned long max_time; unsigned int limit; unsigned int severities; }; diff --git a/src/main-common.c b/src/main-common.c index 2e45710..1c8d062 100644 --- a/src/main-common.c +++ b/src/main-common.c @@ -1,6 +1,8 @@ extern FILE *replay_file; -time_t boot_time, burst_begin, now; +unsigned long boot_time; +unsigned long burst_begin; +unsigned long now; unsigned long burst_length; struct log_type *MAIN_LOG; @@ -59,8 +61,8 @@ static const struct message_entry msgtab[] = { { "MSG_DB_UNKNOWN", "I do not know of a database named %s." }, { "MSG_DB_IS_MONDO", "Database %s is in the \"mondo\" database and cannot be written separately." }, { "MSG_DB_WRITE_ERROR", "Error while writing database %s." }, - { "MSG_DB_WROTE_DB", "Wrote database %s (in "FMT_TIME_T".%06lu seconds)." }, - { "MSG_DB_WROTE_ALL", "Wrote all databases (in "FMT_TIME_T".%06lu seconds)." }, + { "MSG_DB_WROTE_DB", "Wrote database %s (in %lu.%06lu seconds)." }, + { "MSG_DB_WROTE_ALL", "Wrote all databases (in %lu.%06lu seconds)." }, { "MSG_AND", "and" }, { "MSG_0_SECONDS", "0 seconds" }, { "MSG_YEAR", "year" }, diff --git a/src/main.c b/src/main.c index 1cf2da7..2438868 100644 --- a/src/main.c +++ b/src/main.c @@ -193,10 +193,10 @@ int main(int argc, char *argv[]) * mostly to get the right value of "now" for when we do the * irc_introduce. */ replay_read_line(); - boot_time = now; } else { - boot_time = time(&now); + now = time(NULL); } + boot_time = now; fprintf(stdout, "Initializing daemon...\n"); if (!conf_read(services_config)) { @@ -282,7 +282,8 @@ int main(int argc, char *argv[]) free(msg); } } else { - srand(time(&now)); + now = time(NULL); + srand(now); ioset_run(); } return 0; diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index 00f2611..764c3a5 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -91,7 +91,7 @@ const char *helpserv_module_deps[] = { NULL }; /* General */ #define HSFMT_TIME "%a, %d %b %Y %H:%M:%S %Z" static const struct message_entry msgtab[] = { - { "HSMSG_READHELP_SUCCESS", "Read HelpServ help database in "FMT_TIME_T".%03ld seconds." }, + { "HSMSG_READHELP_SUCCESS", "Read HelpServ help database in %lu.%03lu seconds." }, { "HSMSG_INVALID_BOT", "This command requires a valid HelpServ bot name." }, { "HSMSG_ILLEGAL_CHANNEL", "$b%s$b is an illegal channel; cannot use it." }, { "HSMSG_INTERNAL_COMMAND", "$b%s$b appears to be an internal HelpServ command, sorry." }, @@ -479,7 +479,7 @@ static struct { char user_escape; } helpserv_conf; -static time_t last_stats_update; +static unsigned long last_stats_update; static int shutting_down; static FILE *reqlog_f; static struct log_type *HS_LOG; @@ -519,8 +519,8 @@ struct helpserv_bot { unsigned int helpchan_empty : 1; - time_t registered; - time_t last_active; + unsigned long registered; + unsigned long last_active; char *registrar; }; @@ -531,7 +531,7 @@ struct helpserv_user { unsigned int week_start : 3; enum helpserv_level level; /* statistics */ - time_t join_time; /* when they joined, or 0 if not in channel */ + unsigned long join_time; /* when they joined, or 0 if not in channel */ /* [0] through [3] are n weeks ago, [4] is the total of everything before that */ unsigned int time_per_week[5]; /* how long they've were in the channel the past 4 weeks */ unsigned int picked_up[5]; /* how many requests they have picked up */ @@ -562,9 +562,9 @@ struct helpserv_request { struct handle_info *handle; unsigned long id; - time_t opened; - time_t assigned; - time_t updated; + unsigned long opened; + unsigned long assigned; + unsigned long updated; }; #define DEFINE_LIST_ALLOC(STRUCTNAME) \ @@ -659,7 +659,7 @@ struct helpserv_cmd { static void run_empty_interval(void *data); -static void helpserv_interval(char *output, time_t interval) { +static void helpserv_interval(char *output, unsigned long interval) { int num_hours = interval / 3600; int num_minutes = (interval % 3600) / 60; sprintf(output, "%u hour%s, %u minute%s", num_hours, num_hours == 1 ? "" : "s", num_minutes, num_minutes == 1 ? "" : "s"); @@ -698,7 +698,7 @@ static void helpserv_log_request(struct helpserv_request *req, const char *reaso assert(reason != NULL); if (!(ctx = saxdb_open_context(reqlog_f))) return; - sprintf(key, "%s-" FMT_TIME_T "-%lu", req->hs->helpserv->nick, req->opened, req->id); + sprintf(key, "%s-%lu-%lu", req->hs->helpserv->nick, (unsigned long)req->opened, req->id); if ((res = setjmp(ctx->jbuf)) != 0) { log_module(HS_LOG, LOG_ERROR, "Unable to log helpserv request: %s.", strerror(res)); } else { @@ -864,7 +864,7 @@ static struct helpserv_request * create_request(struct userNode *user, struct he req->user = user; req->handle = user->handle_info; if (from_join && self->burst) { - extern time_t burst_begin; + extern unsigned long burst_begin; /* We need to keep all the requests during a burst join together, * even if the burst takes more than 1 second. ircu seems to burst * in reverse-join order. */ @@ -1062,11 +1062,13 @@ static void helpserv_usermsg(struct userNode *user, struct helpserv_bot *hs, con helpserv_msguser(user, "HSMSG_USERCMD_UNKNOWN", cmdname); return; } else if (hs->intervals[INTERVAL_STALE_DELAY] - && (req->updated < (time_t)(now - hs->intervals[INTERVAL_STALE_DELAY])) + && (req->updated < now - hs->intervals[INTERVAL_STALE_DELAY]) && (!hs->req_maxlen || req->text->used < hs->req_maxlen)) { char buf[MAX_LINE_SIZE], updatestr[INTERVALLEN], timestr[MAX_LINE_SIZE]; + time_t feh; - strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&req->opened)); + feh = req->opened; + strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&feh)); intervalString(updatestr, now - req->updated, user->handle_info); if (req->helper && (hs->notify >= NOTIFY_USER)) if (user->handle_info) @@ -1078,7 +1080,8 @@ static void helpserv_usermsg(struct userNode *user, struct helpserv_bot *hs, con helpserv_page(PGSRC_STATUS, "HSMSG_PAGE_UPD_REQUEST_AUTHED", req->id, user->nick, user->handle_info->handle, timestr, updatestr); else helpserv_page(PGSRC_STATUS, "HSMSG_PAGE_UPD_REQUEST_NOT_AUTHED", req->id, user->nick, timestr, updatestr); - strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&now)); + feh = now; + strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&feh)); snprintf(buf, MAX_LINE_SIZE, "[Stale request updated at %s]", timestr); string_list_append(req->text, strdup(buf)); } @@ -1277,7 +1280,7 @@ static HELPSERV_FUNC(cmd_readhelp) { stop.tv_sec -= 1; stop.tv_usec += 1000000; } - helpserv_notice(user, "HSMSG_READHELP_SUCCESS", stop.tv_sec, stop.tv_usec/1000); + helpserv_notice(user, "HSMSG_READHELP_SUCCESS", (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec/1000); return 1; } @@ -1790,6 +1793,7 @@ static void helpserv_show(int from_opserv, struct helpserv_bot *hs, struct userN unsigned int nn; char buf[MAX_LINE_SIZE]; char buf2[INTERVALLEN]; + time_t feh; if (req->user) if (req->handle) @@ -1803,7 +1807,8 @@ static void helpserv_show(int from_opserv, struct helpserv_bot *hs, struct userN helpserv_notice(user, "HSMSG_REQ_INFO_2d", req->handle->handle); else helpserv_notice(user, "HSMSG_REQ_INFO_2e"); - strftime(buf, MAX_LINE_SIZE, HSFMT_TIME, localtime(&req->opened)); + feh = req->opened; + strftime(buf, MAX_LINE_SIZE, HSFMT_TIME, localtime(&feh)); intervalString(buf2, now - req->opened, user->handle_info); helpserv_notice(user, "HSMSG_REQ_INFO_3", buf, buf2); helpserv_notice(user, "HSMSG_REQ_INFO_4"); @@ -1987,6 +1992,7 @@ static HELPSERV_FUNC(cmd_addnote) { struct helpserv_request *req; struct helpserv_user *hs_user=GetHSUser(hs, user->handle_info); int num_requests=0; + time_t feh; REQUIRE_PARMS(3); @@ -2000,7 +2006,8 @@ static HELPSERV_FUNC(cmd_addnote) { note = unsplit_string(argv+2, argc-2, NULL); - strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&now)); + feh = now; + strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&feh)); snprintf(text, MAX_LINE_SIZE, "[Helper note at %s]:", timestr); string_list_append(req->text, strdup(text)); snprintf(text, MAX_LINE_SIZE, " <%s> %s", user->handle_info->handle, note); @@ -2389,7 +2396,7 @@ static void run_whine_interval(void *data) { for (unh = hs->unhandled; unh; unh = unh->next_unhandled) { queuesize++; - if ((now - unh->opened) >= (time_t)hs->intervals[INTERVAL_WHINE_DELAY]) { + if ((now - unh->opened) >= hs->intervals[INTERVAL_WHINE_DELAY]) { helpserv_reqlist_append(&reqlist, unh); } } @@ -2397,7 +2404,7 @@ static void run_whine_interval(void *data) { if (reqlist.used) { char strwhinedelay[INTERVALLEN]; - intervalString(strwhinedelay, (time_t)hs->intervals[INTERVAL_WHINE_DELAY], NULL); + intervalString(strwhinedelay, hs->intervals[INTERVAL_WHINE_DELAY], NULL); #if ANNOYING_ALERT_PAGES tbl.length = reqlist.used + 1; tbl.width = 4; @@ -2502,7 +2509,7 @@ static void run_whine_interval(void *data) { tbl.contents[i][3] = strdup(idle_time); } - intervalString(stridledelay, (time_t)hs->intervals[INTERVAL_IDLE_DELAY], NULL); + intervalString(stridledelay, hs->intervals[INTERVAL_IDLE_DELAY], NULL); helpserv_page(PGSRC_STATUS, "HSMSG_PAGE_IDLE_HEADER", mode_list.used, hs->helpchan->name, stridledelay); table_send(hs->helpserv, hs->page_targets[PGSRC_STATUS]->name, 0, page_types[hs->page_types[PGSRC_STATUS]].func, tbl); @@ -3398,12 +3405,12 @@ static int request_read_helper(const char *key, void *data, void *extra) { log_module(HS_LOG, LOG_ERROR, "Request %s:%s has a nonexistant opening time. Using time(NULL).", hs->helpserv->nick, key); request->opened = time(NULL); } else { - request->opened = (time_t)strtoul(str, NULL, 0); + request->opened = strtoul(str, NULL, 0); } str = database_get_data(rd->d.object, KEY_REQUEST_ASSIGNED, RECDB_QSTRING); if (str) - request->assigned = (time_t)strtoul(str, NULL, 0); + request->assigned = strtoul(str, NULL, 0); str = database_get_data(rd->d.object, KEY_REQUEST_HELPER, RECDB_QSTRING); if (str) { @@ -3593,7 +3600,7 @@ static int helpserv_bot_read(const char *key, void *data, UNUSED_ARG(void *extra hs->notify = str ? notification_from_name(str) : NOTIFY_NONE; str = database_get_data(GET_RECORD_OBJECT(br), KEY_REGISTERED, RECDB_QSTRING); if (str) - hs->registered = (time_t)strtol(str, NULL, 0); + hs->registered = strtol(str, NULL, 0); str = database_get_data(GET_RECORD_OBJECT(br), KEY_IDWRAP, RECDB_QSTRING); if (str) hs->id_wrap = strtoul(str, NULL, 0); @@ -3612,7 +3619,7 @@ static int helpserv_bot_read(const char *key, void *data, UNUSED_ARG(void *extra str = database_get_data(GET_RECORD_OBJECT(br), KEY_AUTO_DEVOICE, RECDB_QSTRING); hs->auto_devoice = str ? enabled_string(str) : 0; str = database_get_data(GET_RECORD_OBJECT(br), KEY_LAST_ACTIVE, RECDB_QSTRING); - hs->last_active = str ? atoi(str) : now; + hs->last_active = str ? strtoul(str, NULL, 0) : now; dict_foreach(users, user_read_helper, hs); @@ -3633,7 +3640,7 @@ helpserv_saxdb_read(struct dict *conf_db) { } str = database_get_data(conf_db, KEY_LAST_STATS_UPDATE, RECDB_QSTRING); - last_stats_update = str ? (time_t)strtol(str, NULL, 0) : now; + last_stats_update = str ? strtoul(str, NULL, 0) : now; return 0; } @@ -4107,6 +4114,7 @@ static void handle_nickserv_auth(struct userNode *user, struct handle_info *old_ for (j=1; j <= helper_reqs.used; j++) { struct helpserv_request *req=helper_reqs.list[j-1]; char reqid[12], timestr[MAX_LINE_SIZE]; + time_t feh; tbl.contents[j] = alloca(tbl.width * sizeof(**tbl.contents)); tbl.contents[j][0] = req->hs->helpserv->nick; @@ -4114,7 +4122,8 @@ static void handle_nickserv_auth(struct userNode *user, struct handle_info *old_ tbl.contents[j][1] = strdup(reqid); tbl.contents[j][2] = req->user ? req->user->nick : "Not online"; tbl.contents[j][3] = req->handle ? req->handle->handle : "Not authed"; - strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&req->opened)); + feh = req->opened; + strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&feh)); tbl.contents[j][4] = strdup(timestr); } @@ -4377,7 +4386,7 @@ static void handle_nickserv_failpw(struct userNode *user, struct handle_info *ha } } -static time_t helpserv_next_stats(time_t after_when) { +static unsigned long helpserv_next_stats(time_t after_when) { struct tm *timeinfo = localtime(&after_when); /* This works because mktime(3) says it will accept out-of-range values @@ -4391,15 +4400,17 @@ static time_t helpserv_next_stats(time_t after_when) { } /* If data != NULL, then don't add to the timeq */ -static void helpserv_run_stats(time_t when) { - struct tm when_s; +static void helpserv_run_stats(unsigned long when) { struct helpserv_bot *hs; struct helpserv_user *hs_user; + time_t feh; + unsigned int day; int i; dict_iterator_t it, it2; last_stats_update = when; - localtime_r(&when, &when_s); + feh = when; + day = localtime(&feh)->tm_wday; for (it=dict_first(helpserv_bots_dict); it; it=iter_next(it)) { hs = iter_data(it); @@ -4407,7 +4418,7 @@ static void helpserv_run_stats(time_t when) { hs_user = iter_data(it2); /* Skip the helper if it's not their week-start day. */ - if (hs_user->week_start != when_s.tm_wday) + if (hs_user->week_start != day) continue; /* Adjust their credit if they are in-channel at rollover. */ @@ -4549,7 +4560,7 @@ int helpserv_init() { /* Make up for downtime... though this will only really affect the * time_per_week */ if (last_stats_update && (helpserv_next_stats(last_stats_update) < now)) { - time_t statsrun = last_stats_update; + unsigned long statsrun = last_stats_update; while ((statsrun = helpserv_next_stats(statsrun)) < now) helpserv_run_stats(statsrun); } diff --git a/src/mod-memoserv.c b/src/mod-memoserv.c index a5e0e99..a54faab 100644 --- a/src/mod-memoserv.c +++ b/src/mod-memoserv.c @@ -91,7 +91,7 @@ struct memo { struct memo_account *recipient; struct memo_account *sender; char *message; - time_t sent; + unsigned long sent; unsigned int is_read : 1; }; @@ -112,7 +112,7 @@ struct memo_account { static struct { struct userNode *bot; - int message_expiry; + unsigned long message_expiry; } memoserv_conf; const char *memoserv_module_deps[] = { NULL }; @@ -190,7 +190,7 @@ expire_memos(UNUSED_ARG(void *data)) } static struct memo* -add_memo(time_t sent, struct memo_account *recipient, struct memo_account *sender, char *message) +add_memo(unsigned long sent, struct memo_account *recipient, struct memo_account *sender, char *message) { struct memo *memo; @@ -275,15 +275,15 @@ static MODCMD_FUNC(cmd_list) struct memo *memo; unsigned int ii; char posted[24]; - struct tm tm; + time_t feh; if (!(ma = memoserv_get_account(user->handle_info))) return 0; reply("MSMSG_LIST_HEAD"); for (ii = 0; (ii < ma->recvd.used) && (ii < 15); ++ii) { memo = ma->recvd.list[ii]; - localtime_r(&memo->sent, &tm); - strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", &tm); + feh = memo->sent; + strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", localtime(&feh)); reply("MSMSG_LIST_FORMAT", ii, memo->sender->handle->handle, posted); } if (ii == 0) @@ -301,14 +301,13 @@ static MODCMD_FUNC(cmd_read) unsigned int memoid; struct memo *memo; char posted[24]; - struct tm tm; + time_t feh; if (!(ma = memoserv_get_account(user->handle_info))) return 0; if (!(memo = find_memo(user, cmd, ma, argv[1], &memoid))) return 0; - localtime_r(&memo->sent, &tm); - strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", &tm); + strftime(posted, sizeof(posted), "%I:%M %p, %m/%d/%Y", localtime(&feh)); reply("MSMSG_MEMO_HEAD", memoid, memo->sender->handle->handle, posted); send_message_type(4, user, cmd->parent->bot, "%s", memo->message); memo->is_read = 1; @@ -467,7 +466,7 @@ memoserv_saxdb_read(struct dict *db) struct record_data *hir; struct memo *memo; dict_iterator_t it; - time_t sent; + unsigned long sent; for (it = dict_first(db); it; it = iter_next(it)) { hir = iter_data(it); @@ -480,7 +479,7 @@ memoserv_saxdb_read(struct dict *db) log_module(MS_LOG, LOG_ERROR, "Date sent not present in memo %s; skipping", iter_key(it)); continue; } - sent = atoi(str); + sent = strtoul(str, NULL, 0); if (!(str = database_get_data(hir->d.object, KEY_RECIPIENT, RECDB_QSTRING))) { log_module(MS_LOG, LOG_ERROR, "Recipient not present in memo %s; skipping", iter_key(it)); diff --git a/src/mod-snoop.c b/src/mod-snoop.c index 11a0e55..899309d 100644 --- a/src/mod-snoop.c +++ b/src/mod-snoop.c @@ -42,7 +42,6 @@ #include #endif -extern time_t now; static struct { struct chanNode *channel; struct userNode *bot; @@ -56,7 +55,7 @@ static int finalized; int snoop_finalize(void); #define SNOOP(FORMAT, ARGS...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, "%s "FORMAT, timestamp , ## ARGS) -#define UPDATE_TIMESTAMP() strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now)) +#define UPDATE_TIMESTAMP() do { time_t feh = now; strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&feh)); } while (0) static void snoop_nick_change(struct userNode *user, const char *old_nick) { diff --git a/src/mod-sockcheck.c b/src/mod-sockcheck.c index 0d216ae..9a18831 100644 --- a/src/mod-sockcheck.c +++ b/src/mod-sockcheck.c @@ -53,7 +53,7 @@ enum sockcheck_decision { typedef struct { irc_in_addr_t addr; const char *reason; - time_t last_touched; + unsigned long last_touched; enum sockcheck_decision decision; char hostname[IRC_NTOP_MAX_SIZE]; /* acts as key for checked_ip_dict */ } *sockcheck_cache_info; @@ -257,10 +257,11 @@ static void sockcheck_print_client(const struct sockcheck_client *client) { static const char *decs[] = {"CHECKING", "ACCEPT", "REJECT"}; - log_module(PC_LOG, LOG_INFO, "client %p: { addr = %p { decision = %s; last_touched = "FMT_TIME_T"; reason = %s; hostname = \"%s\" }; " + log_module(PC_LOG, LOG_INFO, "client %p: { addr = %p { decision = %s; last_touched = %lu; reason = %s; hostname = \"%s\" }; " "test_index = %d; state = %p { port = %d; type = %s; template = \"%s\"; ... }; " "fd = %p(%d); read = %p; read_size = %d; read_used = %d; read_pos = %d; }", - client, client->addr, decs[client->addr->decision], client->addr->last_touched, + client, client->addr, decs[client->addr->decision], + client->addr->last_touched, client->addr->reason, client->addr->hostname, client->test_index, client->state, (client->state ? client->state->port : 0), @@ -715,10 +716,12 @@ sockcheck_queue_address(irc_in_addr_t addr) /* We are already checking this host. */ return; case ACCEPT: - if ((sci->last_touched + sockcheck_conf.max_cache_age) >= (unsigned)now) return; + if (sci->last_touched + sockcheck_conf.max_cache_age >= now) { + return; + } break; case REJECT: - if ((sci->last_touched + sockcheck_conf.gline_duration) >= (unsigned)now) { + if (sci->last_touched + sockcheck_conf.gline_duration >= now) { sockcheck_issue_gline(sci); return; } @@ -970,7 +973,7 @@ sockcheck_clean_cache(UNUSED_ARG(void *data)) string_buffer_append_string(&sb, client_list[nn]->addr->hostname); } string_buffer_append(&sb, '\0'); - log_module(PC_LOG, LOG_INFO, "Cleaning sockcheck cache at "FMT_TIME_T"; current clients: %s.", now, sb.list); + log_module(PC_LOG, LOG_INFO, "Cleaning sockcheck cache at %lu; current clients: %s.", (unsigned long)now, sb.list); string_buffer_clean(&sb); } else { for (curr_clients = dict_new(), nn=0; nn < sockcheck_conf.max_clients; nn++) { @@ -987,7 +990,7 @@ sockcheck_clean_cache(UNUSED_ARG(void *data)) if (((sci->last_touched + max_age) < now) && !dict_find(curr_clients, sci->hostname, NULL)) { if (SOCKCHECK_DEBUG) { - log_module(PC_LOG, LOG_INFO, " .. nuking %s (last touched "FMT_TIME_T").", sci->hostname, sci->last_touched); + log_module(PC_LOG, LOG_INFO, " .. nuking %s (last touched %lu).", sci->hostname, sci->last_touched); } dict_remove(checked_ip_dict, sci->hostname); } diff --git a/src/modcmd.c b/src/modcmd.c index e41a1ea..65f8d29 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -73,8 +73,8 @@ static const struct message_entry msgtab[] = { { "MCMSG_HELPFILE_UNBOUND", "Since that was the last command from module %s on the service, the helpfile for %s was removed." }, { "MCMSG_NO_HELPFILE", "Module %s does not have a help file." }, { "MCMSG_HELPFILE_ERROR", "Syntax error reading %s; help contents not changed." }, - { "MCMSG_HELPFILE_READ", "Read %s help database in "FMT_TIME_T".%03lu seconds." }, - { "MCMSG_COMMAND_TIME", "Command $b%s$b finished in "FMT_TIME_T".%06lu seconds." }, + { "MCMSG_HELPFILE_READ", "Read %s help database in %lu.%03lu seconds." }, + { "MCMSG_COMMAND_TIME", "Command $b%s$b finished in %lu.%06lu seconds." }, { "MCMSG_NEED_OPSERV_LEVEL", "You must have $O access of at least $b%u$b." }, { "MCMSG_NEED_CHANSERV_LEVEL", "You must have $C access of at least $b%u$b in the channel." }, { "MCMSG_NEED_ACCOUNT_FLAGS", "You must have account flags $b%s$b." }, @@ -862,9 +862,9 @@ modcmd_privmsg(struct userNode *user, struct userNode *bot, const char *text, in irc_notice_user(bot,user, "\x01PING\x01"); } } else if (!irccasecmp(text, "TIME")) { - struct tm tm; - localtime_r(&now, &tm); - strftime(response, sizeof(response), "\x01TIME %a %b %d %H:%M:%S %Y\x01", &tm); + time_t feh; + feh = now; + strftime(response, sizeof(response), "\x01TIME %a %b %d %H:%M:%S %Y\x01", localtime(&feh)); irc_notice_user(bot, user, response); } else if (!irccasecmp(text, "USERINFO")) { snprintf(response, sizeof(response), "\x01USERINFO %s\x01", bot->info); @@ -1215,7 +1215,7 @@ static MODCMD_FUNC(cmd_readhelp) { stop.tv_sec -= 1; stop.tv_usec += 1000000; } - reply("MCMSG_HELPFILE_READ", module->name, stop.tv_sec, stop.tv_usec/1000); + reply("MCMSG_HELPFILE_READ", module->name, (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec/1000); return 1; } @@ -1240,7 +1240,7 @@ static MODCMD_FUNC(cmd_timecmd) { stop.tv_sec -= 1; stop.tv_usec += 1000000; } - reply("MCMSG_COMMAND_TIME", cmd_text, stop.tv_sec, stop.tv_usec); + reply("MCMSG_COMMAND_TIME", cmd_text, (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec); return 1; } diff --git a/src/nickserv.c b/src/nickserv.c index 81fe3aa..7e353c1 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -274,7 +274,7 @@ static const struct message_entry msgtab[] = { { "NSMSG_SET_FLAG", "Applied flags $b%s$b to %s's $N account." }, { "NSMSG_FLAG_PRIVILEGED", "You have insufficient access to set flag %c." }, { "NSMSG_DB_UNREADABLE", "Unable to read database file %s; check the log for more information." }, - { "NSMSG_DB_MERGED", "$N merged DB from %s (in "FMT_TIME_T".%03lu seconds)." }, + { "NSMSG_DB_MERGED", "$N merged DB from %s (in %lu.%03lu seconds)." }, { "NSMSG_HANDLE_CHANGED", "$b%s$b's account name has been changed to $b%s$b." }, { "NSMSG_BAD_HANDLE", "Account $b%s$b not registered because it is in use by a network service, is too long, or contains invalid characters." }, { "NSMSG_BAD_NICK", "Nickname $b%s$b not registered because it is in use by a network service, is too long, or contains invalid characters." }, @@ -1313,6 +1313,7 @@ static NICKSERV_FUNC(cmd_handleinfo) struct userNode *target, *next_un; struct handle_info *hi; const char *nsmsg_none; + time_t feh; if (argc < 2) { if (!(hi = user->handle_info)) { @@ -1328,7 +1329,8 @@ static NICKSERV_FUNC(cmd_handleinfo) #ifdef WITH_PROTOCOL_BAHAMUT reply("NSMSG_HANDLEINFO_ID", hi->id); #endif - reply("NSMSG_HANDLEINFO_REGGED", ctime(&hi->registered)); + feh = hi->registered; + reply("NSMSG_HANDLEINFO_REGGED", ctime(&feh)); if (!hi->users) { intervalString(buff, now - hi->lastseen, user->handle_info); @@ -3089,8 +3091,8 @@ static NICKSERV_FUNC(cmd_merge) struct nickserv_discrim { unsigned long flags_on, flags_off; - time_t min_registered, max_registered; - time_t lastseen; + unsigned long min_registered, max_registered; + unsigned long lastseen; unsigned int limit; int min_level, max_level; int min_karma, max_karma; @@ -3123,8 +3125,8 @@ nickserv_discrim_create(struct userNode *user, unsigned int argc, char *argv[]) discrim->max_level = INT_MAX; discrim->limit = 50; discrim->min_registered = 0; - discrim->max_registered = INT_MAX; - discrim->lastseen = LONG_MAX; + discrim->max_registered = ULONG_MAX; + discrim->lastseen = ULONG_MAX; discrim->min_karma = INT_MIN; discrim->max_karma = INT_MAX; @@ -3501,9 +3503,9 @@ nickserv_db_read_handle(const char *handle, dict_t obj) if (str) hi->infoline = strdup(str); str = database_get_data(obj, KEY_REGISTER_ON, RECDB_QSTRING); - hi->registered = str ? (time_t)strtoul(str, NULL, 0) : now; + hi->registered = str ? strtoul(str, NULL, 0) : now; str = database_get_data(obj, KEY_LAST_SEEN, RECDB_QSTRING); - hi->lastseen = str ? (time_t)strtoul(str, NULL, 0) : hi->registered; + hi->lastseen = str ? strtoul(str, NULL, 0) : hi->registered; str = database_get_data(obj, KEY_KARMA, RECDB_QSTRING); hi->karma = str ? strtoul(str, NULL, 0) : 0; /* We want to read the nicks even if disable_nicks is set. This is so @@ -3656,7 +3658,7 @@ static NICKSERV_FUNC(cmd_mergedb) stop.tv_sec -= 1; stop.tv_usec += 1000000; } - reply("NSMSG_DB_MERGED", argv[1], stop.tv_sec, stop.tv_usec/1000); + reply("NSMSG_DB_MERGED", argv[1], (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec/1000); return 1; } @@ -3664,7 +3666,7 @@ static void expire_handles(UNUSED_ARG(void *data)) { dict_iterator_t it, next; - time_t expiry; + unsigned long expiry; struct handle_info *hi; for (it=dict_first(nickserv_handle_dict); it; it=next) { diff --git a/src/nickserv.h b/src/nickserv.h index 4b75a9e..5054de3 100644 --- a/src/nickserv.h +++ b/src/nickserv.h @@ -71,14 +71,14 @@ struct handle_cookie { struct handle_info *hi; char *data; enum cookie_type type; - time_t expires; + unsigned long expires; char cookie[COOKIELEN+1]; }; struct handle_note { struct handle_note *next; - time_t expires; - time_t set; + unsigned long expires; + unsigned long set; int id; char setter[NICKSERV_HANDLE_LEN+1]; char note[1]; @@ -100,8 +100,8 @@ struct handle_info { #ifdef WITH_PROTOCOL_BAHAMUT unsigned long id; #endif - time_t registered; - time_t lastseen; + unsigned long registered; + unsigned long lastseen; int karma; unsigned short flags; unsigned short opserv_level; diff --git a/src/opserv.c b/src/opserv.c index 92cee32..10c6c45 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -296,15 +296,15 @@ struct trusted_host { char *issuer; char *reason; unsigned long limit; - time_t issued; - time_t expires; + unsigned long issued; + unsigned long expires; }; struct gag_entry { char *mask; char *owner; char *reason; - time_t expires; + unsigned long expires; struct gag_entry *next; }; @@ -331,7 +331,7 @@ typedef struct opservDiscrim { char *mask_nick, *mask_ident, *mask_host, *mask_info, *server, *reason, *notice_target, *accountmask; irc_in_addr_t ip_mask; unsigned long limit; - time_t min_ts, max_ts; + unsigned long min_ts, max_ts; unsigned int min_level, max_level, domain_depth, duration, min_clones, min_channels, max_channels; unsigned char ip_mask_bits; unsigned int match_opers : 1, match_trusted : 1, option_log : 1; @@ -434,11 +434,13 @@ static MODCMD_FUNC(cmd_chaninfo) const char *fmt; struct banNode *ban; struct modeNode *moden; + time_t feh; unsigned int n; reply("OSMSG_CHANINFO_HEADER", channel->name); fmt = user_find_message(user, "OSMSG_CHANINFO_TIMESTAMP"); - strftime(buffer, sizeof(buffer), fmt, gmtime(&channel->timestamp)); + feh = channel->timestamp; + strftime(buffer, sizeof(buffer), fmt, gmtime(&feh)); send_message_type(4, user, cmd->parent->bot, "%s", buffer); irc_make_chanmode(channel, buffer); if (channel->bad_channel) @@ -447,7 +449,8 @@ static MODCMD_FUNC(cmd_chaninfo) reply("OSMSG_CHANINFO_MODES", buffer); if (channel->topic_time) { fmt = user_find_message(user, "OSMSG_CHANINFO_TOPIC"); - strftime(buffer, sizeof(buffer), fmt, gmtime(&channel->topic_time)); + feh = channel->topic_time; + strftime(buffer, sizeof(buffer), fmt, gmtime(&feh)); send_message_type(4, user, cmd->parent->bot, buffer, channel->topic_nick, channel->topic); } else { irc_fetchtopic(cmd->parent->bot, channel->name); @@ -458,7 +461,8 @@ static MODCMD_FUNC(cmd_chaninfo) fmt = user_find_message(user, "OSMSG_CHANINFO_BAN"); for (n = 0; n < channel->banlist.used; n++) { ban = channel->banlist.list[n]; - strftime(buffer, sizeof(buffer), fmt, localtime(&ban->set)); + feh = ban->set; + strftime(buffer, sizeof(buffer), fmt, localtime(&feh)); send_message_type(4, user, cmd->parent->bot, buffer, ban->ban, ban->who); } } @@ -1399,7 +1403,9 @@ static MODCMD_FUNC(cmd_stats_links) { static MODCMD_FUNC(cmd_stats_max) { - reply("OSMSG_MAX_CLIENTS", max_clients, asctime(localtime(&max_clients_time))); + time_t feh; + feh = max_clients_time; + reply("OSMSG_MAX_CLIENTS", max_clients, asctime(localtime(&feh))); return 1; } @@ -1548,7 +1554,7 @@ static MODCMD_FUNC(cmd_stats_uplink) { static MODCMD_FUNC(cmd_stats_uptime) { extern int lines_processed; - extern time_t boot_time; + extern unsigned long boot_time; double kernel_time; double user_time; char uptime[INTERVALLEN]; @@ -2180,7 +2186,7 @@ opserv_expire_trusted_host(void *data) } static void -opserv_add_trusted_host(const char *ipaddr, unsigned int limit, const char *issuer, time_t issued, time_t expires, const char *reason) +opserv_add_trusted_host(const char *ipaddr, unsigned int limit, const char *issuer, unsigned long issued, unsigned long expires, const char *reason) { struct trusted_host *th; th = calloc(1, sizeof(*th)); @@ -2532,8 +2538,8 @@ foreach_matching_user(const char *hostmask, discrim_search_func func, void *extr if (!self->uplink) return 0; discrim = calloc(1, sizeof(*discrim)); discrim->limit = dict_size(clients); - discrim->max_level = ~0; - discrim->max_ts = now; + discrim->max_level = UINT_MAX; + discrim->max_ts = ULONG_MAX; discrim->max_channels = INT_MAX; discrim->authed = -1; discrim->info_space = -1; @@ -2583,7 +2589,7 @@ gag_expire(void *data) } unsigned int -gag_create(const char *mask, const char *owner, const char *reason, time_t expires) +gag_create(const char *mask, const char *owner, const char *reason, unsigned long expires) { struct gag_entry *gag; @@ -2607,7 +2613,7 @@ add_gag_helper(const char *key, void *data, UNUSED_ARG(void *extra)) { struct record_data *rd = data; char *owner, *reason, *expstr; - time_t expires; + unsigned long expires; owner = database_get_data(rd->d.object, KEY_OWNER, RECDB_QSTRING); reason = database_get_data(rd->d.object, KEY_REASON, RECDB_QSTRING); @@ -2716,7 +2722,7 @@ trusted_host_read(const char *host, void *data, UNUSED_ARG(void *extra)) { struct record_data *rd = data; const char *limit, *str, *reason, *issuer; - time_t issued, expires; + unsigned long issued, expires; if (rd->type == RECDB_QSTRING) { /* old style host by itself */ @@ -2968,7 +2974,7 @@ static MODCMD_FUNC(cmd_set) static MODCMD_FUNC(cmd_settime) { const char *srv_name_mask = "*"; - time_t new_time = now; + unsigned long new_time = now; if (argc > 1) srv_name_mask = argv[1]; @@ -2987,8 +2993,8 @@ opserv_discrim_create(struct userNode *user, unsigned int argc, char *argv[], in discrim = calloc(1, sizeof(*discrim)); discrim->limit = 250; - discrim->max_level = ~0; - discrim->max_ts = INT_MAX; + discrim->max_level = UINT_MAX; + discrim->max_ts = ULONG_MAX; discrim->domain_depth = 2; discrim->max_channels = INT_MAX; discrim->authed = -1; @@ -3578,18 +3584,18 @@ typedef struct channel_discrim { char *name, *topic; unsigned int min_users, max_users; - time_t min_ts, max_ts; + unsigned long min_ts, max_ts; unsigned int limit; } *cdiscrim_t; static cdiscrim_t opserv_cdiscrim_create(struct userNode *user, unsigned int argc, char *argv[]); static unsigned int opserv_cdiscrim_search(cdiscrim_t discrim, cdiscrim_search_func dsf, void *data); -static time_t +static unsigned long smart_parse_time(const char *str) { /* If an interval-style string is given, treat as time before now. * If it's all digits, treat directly as a Unix timestamp. */ - return str[strspn(str, "0123456789")] ? (time_t)(now - ParseInterval(str)) : (time_t)atoi(str); + return str[strspn(str, "0123456789")] ? (now - ParseInterval(str)) : strtoul(str, NULL, 0); } static cdiscrim_t @@ -3600,9 +3606,8 @@ opserv_cdiscrim_create(struct userNode *user, unsigned int argc, char *argv[]) discrim = calloc(1, sizeof(*discrim)); discrim->limit = 25; - discrim->max_users = ~0; - /* So, time_t is frequently signed. Fun. */ - discrim->max_ts = (1ul << (CHAR_BIT * sizeof(time_t) - 1)) - 1; + discrim->max_users = UINT_MAX; + discrim->max_ts = ULONG_MAX; for (i = 0; i < argc; i++) { /* Assume all criteria require arguments. */ diff --git a/src/opserv.h b/src/opserv.h index 52be101..7daff43 100644 --- a/src/opserv.h +++ b/src/opserv.h @@ -22,7 +22,7 @@ #define _opserv_h void init_opserv(const char *nick); -unsigned int gag_create(const char *mask, const char *owner, const char *reason, time_t expires); +unsigned int gag_create(const char *mask, const char *owner, const char *reason, unsigned long expires); int opserv_bad_channel(const char *name); #endif diff --git a/src/proto-bahamut.c b/src/proto-bahamut.c index 6483ba3..7f8e25f 100644 --- a/src/proto-bahamut.c +++ b/src/proto-bahamut.c @@ -41,7 +41,7 @@ static void privmsg_user_helper(struct userNode *un, void *data); void irc_svsmode(struct userNode *target, char *modes, unsigned long stamp); struct server * -AddServer(struct server *uplink, const char *name, int hops, time_t boot, time_t link, UNUSED_ARG(const char *numeric), const char *description) { +AddServer(struct server *uplink, const char *name, int hops, unsigned long boot, unsigned long link, UNUSED_ARG(const char *numeric), const char *description) { struct server* sNode; sNode = calloc(1, sizeof(*sNode)); @@ -112,7 +112,7 @@ is_valid_nick(const char *nick) { } struct userNode * -AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *userinfo, time_t timestamp, irc_in_addr_t realip, const char *stamp) { +AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *userinfo, unsigned long timestamp, irc_in_addr_t realip, const char *stamp) { struct userNode *uNode, *oldUser; unsigned int nn, dummy; @@ -177,7 +177,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * struct userNode * AddLocalUser(const char *nick, const char *ident, const char *hostname, const char *desc, const char *modes) { - time_t timestamp = now; + unsigned long timestamp = now; struct userNode *old_user = GetUserH(nick); static const irc_in_addr_t ipaddr; @@ -252,9 +252,10 @@ irc_user(struct userNode *user) { if (IsReggedNick(user)) modes[modelen++] = 'r'; if (IsGlobal(user)) modes[modelen++] = 'g'; modes[modelen] = 0; - putsock("NICK %s %d "FMT_TIME_T" +%s %s %s %s %d %u :%s", - user->nick, user->uplink->hops+2, user->timestamp, modes, - user->ident, user->hostname, user->uplink->name, 0, ntohl(user->ip.in6_32[3]), user->info); + putsock("NICK %s %d %lu +%s %s %s %s %d %u :%s", + user->nick, user->uplink->hops+2, (unsigned long)user->timestamp, + modes, user->ident, user->hostname, user->uplink->name, 0, + ntohl(user->ip.in6_32[3]), user->info); } void @@ -293,7 +294,7 @@ irc_nick(struct userNode *user, const char *old_nick) { dict_insert(service_msginfo_dict, user->nick, smi); } } - putsock(":%s NICK %s :"FMT_TIME_T, old_nick, user->nick, user->timestamp); + putsock(":%s NICK %s :%lu", old_nick, user->nick, (unsigned long)user->timestamp); } void @@ -308,12 +309,12 @@ irc_capab() { void irc_svinfo() { - putsock("SVINFO 3 3 0 :"FMT_TIME_T, now); + putsock("SVINFO 3 3 0 :%lu", (unsigned long)now); } void irc_introduce(const char *passwd) { - extern time_t burst_begin; + extern unsigned long burst_begin; irc_pass(passwd); irc_capab(); @@ -410,9 +411,9 @@ irc_wallchops(UNUSED_ARG(struct userNode *from), UNUSED_ARG(const char *to), UNU void irc_join(struct userNode *who, struct chanNode *what) { if (what->members.used == 1) { - putsock(":%s SJOIN "FMT_TIME_T" %s + :@%s", self->name, what->timestamp, what->name, who->nick); + putsock(":%s SJOIN %lu %s + :@%s", self->name, (unsigned long)what->timestamp, what->name, who->nick); } else { - putsock(":%s SJOIN "FMT_TIME_T" %s", who->nick, what->timestamp, what->name); + putsock(":%s SJOIN %lu %s", who->nick, (unsigned long)what->timestamp, what->name); } } @@ -423,16 +424,16 @@ irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to) { void irc_mode(struct userNode *who, struct chanNode *target, const char *modes) { - putsock(":%s MODE %s "FMT_TIME_T" %s", who->nick, target->name, target->timestamp, modes); + putsock(":%s MODE %s %lu %s", who->nick, target->name, (unsigned long)target->timestamp, modes); } void irc_svsmode(struct userNode *target, char *modes, unsigned long stamp) { extern struct userNode *nickserv; if (stamp) { - putsock(":%s SVSMODE %s "FMT_TIME_T" %s %lu", nickserv->nick, target->nick, target->timestamp, modes, stamp); + putsock(":%s SVSMODE %s %lu %s %lu", nickserv->nick, target->nick, (unsigned long)target->timestamp, modes, stamp); } else { - putsock(":%s SVSMODE %s "FMT_TIME_T" %s", nickserv->nick, target->nick, target->timestamp, modes); + putsock(":%s SVSMODE %s %lu %s", nickserv->nick, target->nick, (unsigned long)target->timestamp, modes); } } @@ -478,11 +479,11 @@ irc_gline(struct server *srv, struct gline *gline) { if (len > ArrayLength(ident)) len = ArrayLength(ident); safestrncpy(ident, gline->target, len); safestrncpy(host, sep+1, ArrayLength(host)); - putsock(":%s AKILL %s %s "FMT_TIME_T" %s "FMT_TIME_T" :%s", self->name, host, ident, gline->expires-gline->issued, gline->issuer, gline->issued, gline->reason); + putsock(":%s AKILL %s %s %lu %s %lu :%s", self->name, host, ident, (unsigned long)(gline->expires-gline->issued), gline->issuer, (unsigned long)gline->issued, gline->reason); } void -irc_settime(UNUSED_ARG(const char *srv_name_mask), UNUSED_ARG(time_t new_time)) +irc_settime(UNUSED_ARG(const char *srv_name_mask), UNUSED_ARG(unsigned long new_time)) { /* Bahamut has nothing like this, so ignore it. */ } @@ -533,7 +534,7 @@ irc_stats(struct userNode *from, struct server *target, char type) { void irc_svsnick(struct userNode *from, struct userNode *target, const char *newnick) { - putsock(":%s SVSNICK %s %s :"FMT_TIME_T, from->nick, target->nick, newnick, now); + putsock(":%s SVSNICK %s %s :%lu", from->nick, target->nick, newnick, (unsigned long)now); } void @@ -685,7 +686,7 @@ static void burst_channel(struct chanNode *chan) { if (!chan->members.used) return; /* send list of users in the channel.. */ - base_len = sprintf(line, ":%s SJOIN "FMT_TIME_T" %s ", self->name, chan->timestamp, chan->name); + base_len = sprintf(line, ":%s SJOIN %lu %s ", self->name, (unsigned long)chan->timestamp, chan->name); len = irc_make_chanmode(chan, line+base_len); pos = base_len + len; line[pos++] = ' '; @@ -711,7 +712,7 @@ static void burst_channel(struct chanNode *chan) { line[pos] = 0; putsock("%s", line); /* now send the bans.. */ - base_len = sprintf(line, ":%s MODE "FMT_TIME_T" %s +", self->name, chan->timestamp, chan->name); + base_len = sprintf(line, ":%s MODE %lu %s +", self->name, (unsigned long)chan->timestamp, chan->name); pos = sizeof(line)-1; line[pos] = 0; for (nn=queued=0; nnbanlist.used; nn++) { diff --git a/src/proto-common.c b/src/proto-common.c index ee089ad..618643c 100644 --- a/src/proto-common.c +++ b/src/proto-common.c @@ -57,7 +57,7 @@ extern new_user_func_t *nuf_list; extern unsigned int nuf_size, nuf_used; extern del_user_func_t *duf_list; extern unsigned int duf_size, duf_used; -extern time_t boot_time; +extern unsigned long boot_time; void received_ping(void); @@ -155,7 +155,7 @@ void replay_read_line(void) { struct tm timestamp; - time_t new_time; + unsigned long new_time; if (replay_line[0]) return; read_line: @@ -185,7 +185,7 @@ replay_read_line(void) timestamp.tm_year = strtoul(replay_line+16, NULL, 10) - 1900; timestamp.tm_isdst = 0; new_time = mktime(×tamp); - if (new_time == -1) { + if (new_time == (unsigned long)-1) { log_module(MAIN_LOG, LOG_ERROR, "Unable to parse time struct tm_sec=%d tm_min=%d tm_hour=%d tm_mday=%d tm_mon=%d tm_year=%d", timestamp.tm_sec, timestamp.tm_min, timestamp.tm_hour, timestamp.tm_mday, timestamp.tm_mon, timestamp.tm_year); } else { now = new_time; @@ -353,7 +353,8 @@ static CMD_FUNC(cmd_stats) return 0; switch (argv[1][0]) { case 'u': { - unsigned int uptime = now - boot_time; + unsigned long uptime; + uptime = now - boot_time; irc_numeric(un, RPL_STATSUPTIME, ":Server Up %d days %d:%02d:%02d", uptime/(24*60*60), (uptime/(60*60))%24, (uptime/60)%60, uptime%60); irc_numeric(un, RPL_MAXCONNECTIONS, ":Highest connection count: %d (%d clients)", diff --git a/src/proto-p10.c b/src/proto-p10.c index a0da122..94f41de 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -292,7 +292,7 @@ static struct dict *unbursted_channels; static char *his_servername; static char *his_servercomment; -static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); +static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, unsigned long timestamp, const char *realip); extern int off_channel; @@ -368,10 +368,10 @@ irc_server(struct server *srv) inttobase64(extranum, srv->num_mask, (srv->numeric[1] || (srv->num_mask >= 64*64)) ? 3 : 2); if (srv == self) { /* The +s, ignored by Run's ircu, means "service" to Undernet's ircu */ - putsock(P10_SERVER " %s %d %li %li J10 %s%s +s6 :%s", + putsock(P10_SERVER " %s %d %lu %lu J10 %s%s +s6 :%s", srv->name, srv->hops+1, srv->boot, srv->link, srv->numeric, extranum, srv->description); } else { - putsock("%s " P10_SERVER " %s %d %li %li %c10 %s%s +s6 :%s", + putsock("%s " P10_SERVER " %s %d %lu %lu %c10 %s%s +s6 :%s", self->numeric, srv->name, srv->hops+1, srv->boot, srv->link, (srv->self_burst ? 'J' : 'P'), srv->numeric, extranum, srv->description); } } @@ -484,11 +484,11 @@ irc_user(struct userNode *user) modes[modelen] = 0; /* we don't need to put the + in modes because it's in the format string. */ - putsock("%s " P10_NICK " %s %d %li %s %s +%s %s %s :%s", - user->uplink->numeric, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, modes, b64ip, user->numeric, user->info); + putsock("%s " P10_NICK " %s %d %lu %s %s +%s %s %s :%s", + user->uplink->numeric, user->nick, user->uplink->hops+1, (unsigned long)user->timestamp, user->ident, user->hostname, modes, b64ip, user->numeric, user->info); } else { - putsock("%s " P10_NICK " %s %d %li %s %s %s %s :%s", - user->uplink->numeric, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, b64ip, user->numeric, user->info); + putsock("%s " P10_NICK " %s %d %lu %s %s %s %s :%s", + user->uplink->numeric, user->nick, user->uplink->hops+1, (unsigned long)user->timestamp, user->ident, user->hostname, b64ip, user->numeric, user->info); } } @@ -513,7 +513,7 @@ irc_regnick(UNUSED_ARG(struct userNode *user)) void irc_nick(struct userNode *user, UNUSED_ARG(const char *old_nick)) { - putsock("%s " P10_NICK " %s "FMT_TIME_T, user->numeric, user->nick, now); + putsock("%s " P10_NICK " %s %lu", user->numeric, user->nick, (unsigned long)now); } void @@ -638,7 +638,7 @@ irc_pong_asll(const char *who, const char *orig_ts) orig.tv_usec = (*delim == '.') ? strtoul(delim + 1, NULL, 10) : 0; gettimeofday(&now, NULL); diff = (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000; - putsock("%s " P10_PONG " %s %s %d " FMT_TIME_T ".%06u", self->numeric, who, orig_ts, diff, now.tv_sec, (unsigned)now.tv_usec); + putsock("%s " P10_PONG " %s %s %d %lu.%06lu", self->numeric, who, orig_ts, diff, (unsigned long)now.tv_sec, (unsigned long)now.tv_usec); } void @@ -663,20 +663,20 @@ void irc_gline(struct server *srv, struct gline *gline) { if (gline->lastmod) - putsock("%s " P10_GLINE " %s +%s %ld %ld :%s", - self->numeric, (srv ? srv->numeric : "*"), gline->target, gline->expires-now, gline->lastmod, gline->reason); + putsock("%s " P10_GLINE " %s +%s %lu %lu :%s", + self->numeric, (srv ? srv->numeric : "*"), gline->target, (unsigned long)(gline->expires-now), (unsigned long)gline->lastmod, gline->reason); else - putsock("%s " P10_GLINE " %s +%s %ld :%s", - self->numeric, (srv ? srv->numeric : "*"), gline->target, gline->expires-now, gline->reason); + putsock("%s " P10_GLINE " %s +%s %lu :%s", + self->numeric, (srv ? srv->numeric : "*"), gline->target, (unsigned long)(gline->expires-now), gline->reason); } void -irc_settime(const char *srv_name_mask, time_t new_time) +irc_settime(const char *srv_name_mask, unsigned long new_time) { ioset_set_time(new_time); if (!strcmp(srv_name_mask, "*")) srv_name_mask = ""; - putsock("%s " P10_SETTIME " " FMT_TIME_T " %s", self->numeric, new_time, srv_name_mask); + putsock("%s " P10_SETTIME " %lu %s", self->numeric, new_time, srv_name_mask); } void @@ -696,8 +696,9 @@ irc_burst(struct chanNode *chan) unsigned int first_ban; unsigned int n; - base_len = sprintf(burst_line, "%s " P10_BURST " %s " FMT_TIME_T " ", - self->numeric, chan->name, chan->timestamp); + base_len = sprintf(burst_line, "%s " P10_BURST " %s %lu ", + self->numeric, chan->name, + (unsigned long)chan->timestamp); len = irc_make_chanmode(chan, burst_line+base_len); pos = base_len + len; if (len > 0 && chan->members.used > 0) @@ -791,9 +792,9 @@ irc_kill(struct userNode *from, struct userNode *target, const char *message) void irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { - putsock("%s " P10_MODE " %s %s "FMT_TIME_T, + putsock("%s " P10_MODE " %s %s %lu", (from ? from->numeric : self->numeric), - target->name, modes, target->timestamp); + target->name, modes, (unsigned long)target->timestamp); } void @@ -807,9 +808,10 @@ irc_join(struct userNode *who, struct chanNode *what) { if (what->members.used == 1) { putsock("%s " P10_CREATE " %s %lu", - who->numeric, what->name, what->timestamp); + who->numeric, what->name, (unsigned long)what->timestamp); } else { - putsock("%s " P10_JOIN " %s %lu", who->numeric, what->name, what->timestamp); + putsock("%s " P10_JOIN " %s %lu", who->numeric, what->name, + (unsigned long)what->timestamp); } } @@ -832,7 +834,7 @@ irc_stats(struct userNode *from, struct server *target, char type) void irc_svsnick(struct userNode *from, struct userNode *target, const char *newnick) { - putsock("%s " P10_SVSNICK " %s %s "FMT_TIME_T, from->uplink->numeric, target->numeric, newnick, now); + putsock("%s " P10_SVSNICK " %s %s %lu", from->uplink->numeric, target->numeric, newnick, (unsigned long)now); } void @@ -1003,7 +1005,7 @@ static CMD_FUNC(cmd_server) if (srv->boot <= PREHISTORY) { /* Server from the mists of time.. */ if (srv->hops == 1) { - log_module(MAIN_LOG, LOG_ERROR, "Server %s claims to have booted at time "FMT_TIME_T". This is absurd.", srv->name, srv->boot); + log_module(MAIN_LOG, LOG_ERROR, "Server %s claims to have booted at time %lu. This is absurd.", srv->name, (unsigned long)srv->boot); } } else if ((str = conf_get_data("server/reliable_clock", RECDB_QSTRING)) && enabled_string(str)) { @@ -1018,7 +1020,7 @@ static CMD_FUNC(cmd_server) } } if (srv == self->uplink) { - extern time_t burst_begin; + extern unsigned long burst_begin; burst_begin = now; } return 1; @@ -1050,7 +1052,7 @@ static CMD_FUNC(cmd_eob) static CMD_FUNC(cmd_eob_ack) { - extern time_t burst_begin; + extern unsigned long burst_begin; if (GetServerH(origin) == self->uplink) { burst_length = now - burst_begin; @@ -1091,7 +1093,7 @@ static CMD_FUNC(cmd_error_nick) struct create_desc { struct userNode *user; - time_t when; + unsigned long when; }; static void @@ -1217,7 +1219,7 @@ static CMD_FUNC(cmd_burst) long mode; int oplevel = -1; char *user, *end, sep; - time_t in_timestamp; + unsigned long in_timestamp; if (argc < 3) return 0; @@ -1376,7 +1378,7 @@ static CMD_FUNC(cmd_clearmode) static CMD_FUNC(cmd_topic) { struct chanNode *cn; - time_t chan_ts, topic_ts; + unsigned long chan_ts, topic_ts; if (argc < 3) return 0; @@ -1435,7 +1437,7 @@ static CMD_FUNC(cmd_num_topic) static CMD_FUNC(cmd_num_gline) { - time_t lastmod; + unsigned long lastmod; if (argc < 6) return 0; lastmod = (argc > 5) ? strtoul(argv[5], NULL, 0) : 0; @@ -1554,7 +1556,7 @@ static CMD_FUNC(cmd_away) static CMD_FUNC(cmd_gline) { - time_t lastmod; + unsigned long lastmod; if (argc < 3) return 0; @@ -1912,7 +1914,7 @@ make_numeric(struct server *svr, int local_num, char *outbuf) } struct server * -AddServer(struct server *uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description) +AddServer(struct server *uplink, const char *name, int hops, unsigned long boot, unsigned long link, const char *numeric, const char *description) { struct server* sNode; int slen, mlen; @@ -1999,7 +2001,7 @@ AddLocalUser(const char *nick, const char *ident, const char *hostname, const ch { char numeric[COMBO_NUMERIC_LEN+1]; int local_num = get_local_numeric(); - time_t timestamp = now; + unsigned long timestamp = now; struct userNode *old_user = GetUserH(nick); if (!modes) @@ -2024,7 +2026,7 @@ AddClone(const char *nick, const char *ident, const char *hostname, const char * { char numeric[COMBO_NUMERIC_LEN+1]; int local_num = get_local_numeric(); - time_t timestamp = now; + unsigned long timestamp = now; struct userNode *old_user = GetUserH(nick); if (old_user) { @@ -2056,7 +2058,7 @@ is_valid_nick(const char *nick) { } static struct userNode* -AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip) +AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, unsigned long timestamp, const char *realip) { struct userNode *oldUser, *uNode; unsigned int n, ignore_user, dummy; diff --git a/src/proto.h b/src/proto.h index 23f4a31..04ccb78 100644 --- a/src/proto.h +++ b/src/proto.h @@ -135,7 +135,7 @@ void irc_fetchtopic(struct userNode *from, const char *to); /* network maintenance */ void irc_gline(struct server *srv, struct gline *gline); -void irc_settime(const char *srv_name_mask, time_t new_time); +void irc_settime(const char *srv_name_mask, unsigned long new_time); void irc_ungline(const char *mask); void irc_error(const char *to, const char *message); void irc_kill(struct userNode *from, struct userNode *target, const char *message); @@ -169,7 +169,7 @@ void irc_numeric(struct userNode *user, unsigned int num, const char *format, .. int IsChannelName(const char *name); int is_valid_nick(const char *nick); struct userNode *AddLocalUser(const char *nick, const char *ident, const char *hostname, const char *desc, const char *modes); -struct server* AddServer(struct server* uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description); +struct server* AddServer(struct server* uplink, const char *name, int hops, unsigned long boot, unsigned long link, const char *numeric, const char *description); void DelServer(struct server* serv, int announce, const char *message); void DelUser(struct userNode* user, struct userNode *killer, int announce, const char *why); /* Most protocols will want to make an AddUser helper function. */ diff --git a/src/sar.c b/src/sar.c index b563750..6c5c731 100644 --- a/src/sar.c +++ b/src/sar.c @@ -259,14 +259,14 @@ sar_request_fail(struct sar_request *req, unsigned int rcode) sar_request_abort(req); } -static time_t next_sar_timeout; +static unsigned long next_sar_timeout; static void sar_timeout_cb(void *data) { dict_iterator_t it; dict_iterator_t next; - time_t next_timeout = INT_MAX; + unsigned long next_timeout = INT_MAX; for (it = dict_first(sar_requests); it; it = next) { struct sar_request *req; @@ -289,7 +289,7 @@ sar_timeout_cb(void *data) } static void -sar_check_timeout(time_t when) +sar_check_timeout(unsigned long when) { if (!next_sar_timeout || when < next_sar_timeout) { timeq_del(0, sar_timeout_cb, NULL, TIMEQ_IGNORE_WHEN | TIMEQ_IGNORE_DATA); diff --git a/src/sar.h b/src/sar.h index 9616fc1..c0a7b4a 100644 --- a/src/sar.h +++ b/src/sar.h @@ -138,7 +138,7 @@ typedef void (*sar_request_fail_cb)(struct sar_request *req, unsigned int rcode) */ struct sar_request { int id; - time_t expiry; + unsigned long expiry; sar_request_ok_cb cb_ok; sar_request_fail_cb cb_fail; unsigned char *body; diff --git a/src/saxdb.c b/src/saxdb.c index c233775..5787f65 100644 --- a/src/saxdb.c +++ b/src/saxdb.c @@ -33,7 +33,7 @@ struct saxdb { saxdb_reader_func_t *reader; saxdb_writer_func_t *writer; unsigned int write_interval; - time_t last_write; + unsigned long last_write; unsigned int last_write_duration; struct saxdb *prev; }; @@ -122,7 +122,7 @@ saxdb_write_db(struct saxdb *db) { struct saxdb_context ctx; char tmp_fname[MAXLEN]; int res, res2; - time_t start, finish; + unsigned long start, finish; assert(db->filename); sprintf(tmp_fname, "%s.new", db->filename); @@ -387,7 +387,7 @@ static MODCMD_FUNC(cmd_write) { stop.tv_sec -= 1; stop.tv_usec += 1000000; } - reply("MSG_DB_WROTE_DB", db->name, stop.tv_sec, stop.tv_usec); + reply("MSG_DB_WROTE_DB", db->name, (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec); written++; } } @@ -406,7 +406,7 @@ static MODCMD_FUNC(cmd_writeall) { stop.tv_sec -= 1; stop.tv_usec += 1000000; } - reply("MSG_DB_WROTE_ALL", stop.tv_sec, stop.tv_usec); + reply("MSG_DB_WROTE_ALL", (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec); return 1; } diff --git a/src/timeq.c b/src/timeq.c index ba91f6b..b5a6624 100644 --- a/src/timeq.c +++ b/src/timeq.c @@ -40,22 +40,22 @@ timeq_cleanup(void) static void timeq_init(void) { - timeq = heap_new(int_comparator); + timeq = heap_new(ulong_comparator); reg_exit_func(timeq_cleanup); } -time_t +unsigned long timeq_next(void) { void *time; if (!timeq) return ~0; heap_peek(timeq, &time, 0); - return (time_t)time; + return (unsigned long)time; } void -timeq_add(time_t when, timeq_func func, void *data) +timeq_add(unsigned long when, timeq_func func, void *data) { struct timeq_entry *ent; void *w; @@ -69,7 +69,7 @@ timeq_add(time_t when, timeq_func func, void *data) } struct timeq_extra { - time_t when; + unsigned long when; timeq_func func; void *data; int mask; @@ -80,7 +80,7 @@ timeq_del_matching(void *key, void *data, void *extra) { struct timeq_entry *a = data; struct timeq_extra *b = extra; - if (((b->mask & TIMEQ_IGNORE_WHEN) || ((time_t)key == b->when)) + if (((b->mask & TIMEQ_IGNORE_WHEN) || ((unsigned long)key == b->when)) && ((b->mask & TIMEQ_IGNORE_FUNC) || (a->func == b->func)) && ((b->mask & TIMEQ_IGNORE_DATA) || (a->data == b->data))) { free(data); @@ -91,7 +91,7 @@ timeq_del_matching(void *key, void *data, void *extra) } void -timeq_del(time_t when, timeq_func func, void *data, int mask) +timeq_del(unsigned long when, timeq_func func, void *data, int mask) { struct timeq_extra extra; extra.when = when; @@ -115,7 +115,7 @@ timeq_run(void) struct timeq_entry *ent; while (heap_size(timeq) > 0) { heap_peek(timeq, &k, &d); - if ((time_t)k > now) + if ((unsigned long)k > now) break; ent = d; heap_pop(timeq); diff --git a/src/timeq.h b/src/timeq.h index f3ffe90..e20610e 100644 --- a/src/timeq.h +++ b/src/timeq.h @@ -27,9 +27,9 @@ typedef void (*timeq_func)(void *data); #define TIMEQ_IGNORE_FUNC 0x02 #define TIMEQ_IGNORE_DATA 0x04 -void timeq_add(time_t when, timeq_func func, void *data); -void timeq_del(time_t when, timeq_func func, void *data, int mask); -time_t timeq_next(void); +void timeq_add(unsigned long when, timeq_func func, void *data); +void timeq_del(unsigned long when, timeq_func func, void *data, int mask); +unsigned long timeq_next(void); unsigned int timeq_size(void); void timeq_run(void); diff --git a/src/tools.c b/src/tools.c index 691471c..8f0c299 100644 --- a/src/tools.c +++ b/src/tools.c @@ -855,12 +855,12 @@ unsplit_string(char *set[], unsigned int max, char *dest) } char * -intervalString(char *output, time_t interval, struct handle_info *hi) +intervalString(char *output, unsigned long interval, struct handle_info *hi) { static const struct { const char *msg_single; const char *msg_plural; - long length; + unsigned long length; } unit[] = { { "MSG_YEAR", "MSG_YEARS", 365 * 24 * 60 * 60 }, { "MSG_WEEK", "MSG_WEEKS", 7 * 24 * 60 * 60 }, -- 2.20.1