<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>RE: [openib-general] OpenSM Log Message Format</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi Hal,</FONT>
</P>

<P><FONT SIZE=2>I have incorporated your patch into the next next release code.</FONT>
<BR><FONT SIZE=2>If it is urgent you can put it directly into gen2 too.</FONT>
</P>

<P><FONT SIZE=2>EZ</FONT>
</P>

<P><FONT SIZE=2>Eitan Zahavi</FONT>
<BR><FONT SIZE=2>Design Technology Director</FONT>
<BR><FONT SIZE=2>Mellanox Technologies LTD</FONT>
<BR><FONT SIZE=2>Tel:+972-4-9097208</FONT>
<BR><FONT SIZE=2>Fax:+972-4-9593245</FONT>
<BR><FONT SIZE=2>P.O. Box 586 Yokneam 20692 ISRAEL</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Hal Rosenstock [<A HREF="mailto:halr@voltaire.com">mailto:halr@voltaire.com</A>] </FONT>
<BR><FONT SIZE=2>Sent: Wednesday, January 12, 2005 4:05 PM</FONT>
<BR><FONT SIZE=2>To: openib-general@openib.org</FONT>
<BR><FONT SIZE=2>Subject: [openib-general] OpenSM Log Message Format</FONT>
</P>

<P><FONT SIZE=2>Hi,</FONT>
</P>

<P><FONT SIZE=2>Should date/time format be used rather than timeval when OSM logs</FONT>
<BR><FONT SIZE=2>messages ? That would make the messages more like the other daemons.</FONT>
<BR><FONT SIZE=2>Here's a proposed patch to do this.</FONT>
</P>

<P><FONT SIZE=2>Signed-off-by: Hal Rosenstock <halr@voltaire.com></FONT>
</P>

<P><FONT SIZE=2>-- Hal</FONT>
<BR><FONT SIZE=2>Index: osm_log.c</FONT>
<BR><FONT SIZE=2>===================================================================</FONT>
<BR><FONT SIZE=2>--- osm_log.c   (revision 1519)</FONT>
<BR><FONT SIZE=2>+++ osm_log.c   (working copy)</FONT>
<BR><FONT SIZE=2>@@ -96,6 +96,23 @@</FONT>
<BR><FONT SIZE=2> #include <unistd.h></FONT>
<BR><FONT SIZE=2> #endif</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>+#ifndef WIN32</FONT>
<BR><FONT SIZE=2>+static char *month_str[] = {</FONT>
<BR><FONT SIZE=2>+  "Jan",</FONT>
<BR><FONT SIZE=2>+  "Feb",</FONT>
<BR><FONT SIZE=2>+  "Mar",</FONT>
<BR><FONT SIZE=2>+  "Apr",</FONT>
<BR><FONT SIZE=2>+  "May",</FONT>
<BR><FONT SIZE=2>+  "Jun",</FONT>
<BR><FONT SIZE=2>+  "Jul",</FONT>
<BR><FONT SIZE=2>+  "Aug",</FONT>
<BR><FONT SIZE=2>+  "Sep",</FONT>
<BR><FONT SIZE=2>+  "Oct",</FONT>
<BR><FONT SIZE=2>+  "Nov",</FONT>
<BR><FONT SIZE=2>+  "Dec"</FONT>
<BR><FONT SIZE=2>+};</FONT>
<BR><FONT SIZE=2>+#endif</FONT>
<BR><FONT SIZE=2>+</FONT>
<BR><FONT SIZE=2> void</FONT>
<BR><FONT SIZE=2> osm_log(</FONT>
<BR><FONT SIZE=2>   IN osm_log_t* const p_log,</FONT>
<BR><FONT SIZE=2>@@ -111,8 +128,8 @@</FONT>
<BR><FONT SIZE=2>   uint32_t pid = GetCurrentThreadId();</FONT>
<BR><FONT SIZE=2> #else</FONT>
<BR><FONT SIZE=2>   pid_t pid;</FONT>
<BR><FONT SIZE=2>-  struct timeval tv;</FONT>
<BR><FONT SIZE=2>-  struct timezone tz;</FONT>
<BR><FONT SIZE=2>+  time_t tim;</FONT>
<BR><FONT SIZE=2>+  struct tm result;</FONT>
<BR><FONT SIZE=2> #endif /*  WIN32 */</FONT>
<BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2>   /* If this is a call to syslog - always print it */</FONT>
<BR><FONT SIZE=2>@@ -152,9 +169,12 @@</FONT>
<BR><FONT SIZE=2>       </FONT>
<BR><FONT SIZE=2> #else</FONT>
<BR><FONT SIZE=2>       pid = pthread_self();</FONT>
<BR><FONT SIZE=2>-      gettimeofday( &tv, &tz );</FONT>
<BR><FONT SIZE=2>-      ret = fprintf( p_log->out_port, "[%09ld:%09ld][%04X] -> %s",</FONT>
<BR><FONT SIZE=2>-                     tv.tv_sec, (long)tv.tv_usec,</FONT>
<BR><FONT SIZE=2>+      tim = time(NULL);</FONT>
<BR><FONT SIZE=2>+      localtime_r(&tim, &result);</FONT>
<BR><FONT SIZE=2>+      ret = fprintf( p_log->out_port, "%s %02d %02d:%02d:%02d [%04X] -> %s",</FONT>
<BR><FONT SIZE=2>+                    (result.tm_mon < 12 ? month_str[result.tm_mon] : "???"),</FONT>
<BR><FONT SIZE=2>+                     result.tm_mday, result.tm_hour,</FONT>
<BR><FONT SIZE=2>+                     result.tm_min, result.tm_sec,</FONT>
<BR><FONT SIZE=2>                      pid, buffer);</FONT>
<BR><FONT SIZE=2> #endif /*  WIN32 */</FONT>
<BR><FONT SIZE=2>       </FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>openib-general mailing list</FONT>
<BR><FONT SIZE=2>openib-general@openib.org</FONT>
<BR><FONT SIZE=2><A HREF="http://openib.org/mailman/listinfo/openib-general" TARGET="_blank">http://openib.org/mailman/listinfo/openib-general</A></FONT>
</P>

<P><FONT SIZE=2>To unsubscribe, please visit <A HREF="http://openib.org/mailman/listinfo/openib-general" TARGET="_blank">http://openib.org/mailman/listinfo/openib-general</A></FONT>
</P>

</BODY>
</HTML>