]> code.citadel.org Git - citadel.git/commitdiff
* Don't assume pointer to time_t is compatible with pointer to
authorMichael Hampton <io_error@uncensored.citadel.org>
Wed, 16 Oct 2002 08:59:41 +0000 (08:59 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Wed, 16 Oct 2002 08:59:41 +0000 (08:59 +0000)
  struct timeval.tv_sec (it isn't on darwin)

citadel/ChangeLog
citadel/sysdep.c

index 0e107aff3cbd26ec5591baba2a645adf14f53cd3..327adb9e165f8226288a635f385311ad4cd60c74 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 601.30  2002/10/16 08:59:41  error
+ * Don't assume pointer to time_t is compatible with pointer to
+   struct timeval.tv_sec (it isn't on darwin)
+
  Revision 601.29  2002/10/16 02:49:55  ajc
  * CtdlWriteObject() encode in memory instead of on disk (not tested)
 
@@ -4083,4 +4087,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index dcf4cd7ab785bee87bf87cf10c40fe62f572291b..4a3b106e205de4e0860031bfe847a750490b6d25 100644 (file)
@@ -110,9 +110,12 @@ void lprintf(int loglevel, const char *format, ...) {
        if (loglevel <= verbosity) { 
                struct timeval tv;
                struct tm *tim;
+               time_t unixtime;
 
                gettimeofday(&tv, NULL);
-               tim = localtime(&(tv.tv_sec));
+               /* Promote to time_t; types differ on some OSes (like darwin) */
+               unixtime = tv.tv_sec;
+               tim = localtime(&unixtime);
                /*
                 * Log provides millisecond accuracy.  If you need
                 * microsecond accuracy and your OS supports it, change