[Freeipmi-devel] [bug #38799] IPMI 2.0 Special Timestamp values are not supported

2013-04-27 Thread Albert Chu
Follow-up Comment #2, bug #38799 (project freeipmi):

In order to get this to work in all of FreeIPMI, it'll require a bit of
architecture change, so I'm going to aim this for FreeIPMI 1.3.1 instead of a
1.2.X minor release.

___

Reply to this item at:

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

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


___
Freeipmi-devel mailing list
Freeipmi-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/freeipmi-devel


[Freeipmi-devel] [bug #38799] IPMI 2.0 Special Timestamp values are not supported

2013-04-25 Thread Rob Swindell
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  0x
+#define IPMI_TIMESTAMP_POST_INIT0x2000
+  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
Freeipmi-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/freeipmi-devel