Follow-up Comment #1, bug #38799 (project freeipmi):

Here's a patch for one instance of this problem. A more generic "IPMI
timestamp" display function should be created and used through-out the
IPMI/DCMI code to address this problem globally:

Index: bmc-device/bmc-device.c
===================================================================
--- bmc-device/bmc-device.c     (revision 9608)
+++ bmc-device/bmc-device.c     (working copy)
@@ -1274,15 +1274,26 @@
       goto cleanup;
     }

-  /* Posix says individual calls need not clear/set all portions of
-   * 'struct tm', thus passing 'struct tm' between functions could
-   * have issues.  So we need to memset.
-   */
-  memset (&tm, ' ', sizeof(struct tm));
+/* Per IPMI 2.0 section 37.1: */
+#define IPMI_TIMESTAMP_UNSPECIFIED      0xffffffff
+#define IPMI_TIMESTAMP_POST_INIT        0x20000000
+  if (val == IPMI_TIMESTAMP_UNSPECIFIED)
+    snprintf (timestr, sizeof (timestr), "Unspecified");
+  else if (val <= IPMI_TIMESTAMP_POST_INIT)
+    snprintf (timestr, sizeof (timestr), "%u seconds since initialization",
(unsigned)val);
+  else
+    {
+      /* Posix says individual calls need not clear/set all portions of
+       * 'struct tm', thus passing 'struct tm' between functions could
+       * have issues.  So we need to memset.
+       */
+      memset (&tm, ' ', sizeof(struct tm));

-  t = val;
-  localtime_r (&t, &tm);
-  strftime (timestr, sizeof (timestr), "%m/%d/%Y - %H:%M:%S", &tm);
+      t = val;
+      localtime_r (&t, &tm);
+      strftime (timestr, sizeof (timestr), "%m/%d/%Y - %H:%M:%S", &tm);
+    }
+
   pstdout_printf (state_data->pstate,
                   "SEL Time : %sn",
                   timestr);


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38799>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Freeipmi-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/freeipmi-devel

Reply via email to