changeset 1458:17e95be6c39b

time_t fix from the MirBSD port (Thorsten Glaser)
author Mikael Berthe <mikael@lilotux.net>
date Fri, 11 Apr 2008 21:24:02 +0200
parents 3a537b4d7f8d
children d76eff4ed71d
files mcabber/src/utils.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/utils.c	Fri Apr 11 19:43:54 2008 +0200
+++ b/mcabber/src/utils.c	Fri Apr 11 21:24:02 2008 +0200
@@ -203,7 +203,7 @@
   tm_time = gmtime(&timestamp);
 
   ret = snprintf(dststr, 19, "%.4d%02d%02dT%02d:%02d:%02dZ",
-        1900+tm_time->tm_year, tm_time->tm_mon+1, tm_time->tm_mday,
+        (int)(1900+tm_time->tm_year), tm_time->tm_mon+1, tm_time->tm_mday,
         tm_time->tm_hour, tm_time->tm_min, tm_time->tm_sec);
 
   return ((ret == -1) ? -1 : 0);
@@ -222,6 +222,7 @@
   char *c;
   int tzoff = 0;
   int hms_succ = 0;
+  int tmpyear;
 
   time(&retval);
   localtime_r(&retval, &t);
@@ -233,7 +234,8 @@
   c = buf;
 
   /* 4 digit year */
-  if (!sscanf(c, "%04d", &t.tm_year)) return 0;
+  if (!sscanf(c, "%04d", &tmpyear)) return 0;
+  t.tm_year = tmpyear;
   c+=4;
   if (*c == '-')
     c++;