ipmitool/ipmitool-POH-scale

31 lines
946 B
Plaintext

--- ipmitool-1.8.9/lib/ipmi_chassis.c.orig 2007-02-22 09:38:56.000000000 +0100
+++ ipmitool-1.8.9/lib/ipmi_chassis.c 2008-01-17 15:07:23.000000000 +0100
@@ -189,6 +189,8 @@ ipmi_chassis_poh(struct ipmi_intf * intf
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint32_t count;
+ unsigned long hcount;
+ unsigned char minutes, scale;
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_CHASSIS;
@@ -206,9 +208,16 @@ ipmi_chassis_poh(struct ipmi_intf * intf
}
memcpy(&count, rsp->data+1, 4);
+#if WORDS_BIGENDIAN
+ count = BSWAP_32(count);
+#endif
+ scale = rsp->data[0];
+ hcount = count * scale;
+ minutes = hcount % 60;
+ hcount /= 60;
- printf("POH Counter : %li hours total (%li days, %li hours)\n",
- (long)count, (long)(count / 24), (long)(count % 24));
+ printf("POH Counter : %li hours total (%li days, %lih%02d')\n",
+ (long)hcount, (long)(hcount / 24), (long)(hcount % 24), minutes);
return 0;
}