freeipmi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freeipmi-devel] [bug #38799] IPMI 2.0 "Special Timestamp values" are no


From: Rob Swindell
Subject: [Freeipmi-devel] [bug #38799] IPMI 2.0 "Special Timestamp values" are not supported
Date: Thu, 25 Apr 2013 22:29:12 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]