aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-10 02:30:32 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-10 02:30:32 +0100
commit8bf07cc9c15fbaa63817add26a0d0c7acad65e9d (patch)
treeec42820af5f73eaf7bdaaa000f8985bae4470b2d
parent9fc62e3f5c4327031a8059a9decb667b30488990 (diff)
Fixed a bug in fix_time() -- did return a local address
-rw-r--r--FICS/utils.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index c5e3353..f17ce06 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -643,26 +643,27 @@ PRIVATE char *strtime(struct tm * stm)
return (tstr);
}
-PUBLIC char *fix_time(char *old_time) {
-
- char day[5];
- char month[5];
- char date[5];
- char new_time[20];
- char i;
-
- sscanf(old_time, "%s %s %s", day, month, date);
-
- if (date[2] != ',') {
- i = date[0];
- date[0] = '0';
- date[1] = i;
- }
- date[2] = '\0';
+PUBLIC char *
+fix_time(char *old_time)
+{
+ char date[5];
+ char day[5];
+ char i;
+ char month[5];
+ static char new_time[20];
+
+ sscanf(old_time, "%s %s %s", day, month, date);
+
+ if (date[2] != ',') {
+ i = date[0];
+ date[0] = '0';
+ date[1] = i;
+ }
+ date[2] = '\0';
- sprintf (new_time, "%s, %s %s", day, month, date);
+ sprintf(new_time, "%s, %s %s", day, month, date);
- return new_time;
+ return &new_time[0];
}
PUBLIC char *strltime(time_t *clock)