From 2b48e428a5173c2c70039778463d1e197fec53d9 Mon Sep 17 00:00:00 2001
From: manfred99 <manfred99@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sun, 1 Mar 2009 20:28:44 +0000
Subject: [PATCH] atacmds.cpp: clip raw value of Power_On_Hours to 4 bytes

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2742 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG   | 7 ++++++-
 sm5/atacmds.cpp | 9 ++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 35fff0236..fcfa27f09 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.775 2009/02/27 22:42:51 chrfranke Exp $
+$Id: CHANGELOG,v 1.776 2009/03/01 20:28:43 manfred99 Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -41,6 +41,11 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [MS] Workaround for huge raw values of attribute 9, needed
+       for Hitachi Travelstar C4K60. For the Power_On_Minutes case,
+       clip the display to 4 bytes and show the remaining part, 
+       if existent, in parens.
+
   [CF] Add experimental option '-d usbjmicron[,PORT]' for drives
        behind JMicron USB bridges. Tested on WinXP with JM20336 in
        AixCase AIX-ESU35CD. Many thanks to JMicron tech support
diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp
index 5029ee573..5951f6027 100644
--- a/sm5/atacmds.cpp
+++ b/sm5/atacmds.cpp
@@ -39,7 +39,7 @@
 
 #include <algorithm> // std::sort
 
-const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.213 2009/02/28 18:26:35 chrfranke Exp $"
+const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.214 2009/03/01 20:28:44 manfred99 Exp $"
 ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSIATA_H_CVSID UTILITY_H_CVSID;
 
 // for passing global control variables
@@ -1905,9 +1905,12 @@ int64_t ataPrintSmartAttribRawValue(char *out,
   case 9:
     if (select==1){
       // minutes
-      int64_t tmp1=rawvalue/60;
-      int64_t tmp2=rawvalue%60;
+      int64_t temp=word[0]+(word[1]<<16);
+      int64_t tmp1=temp/60;
+      int64_t tmp2=temp%60;
       out+=sprintf(out, "%"PRIu64"h+%02"PRIu64"m", tmp1, tmp2);
+      if (word[2])
+        out+=sprintf(out, " (%u)", word[2]);
     }
     else if (select==3){
       // seconds
-- 
GitLab