From 7fd680a191f6987b4f4d2426ef2d09d63eb042fe Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 7 Apr 2008 15:31:27 +0000 Subject: [PATCH] -Fix IPMI display of uptime style timestamps (values less than 0x20000000) git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@990 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/ipmi.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm b/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm index ad2257cc6..6048c4af8 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/ipmi.pm @@ -2590,7 +2590,10 @@ sub eventlog { next; } - my $timestamp = ($sel_data[3] | $sel_data[4]<<8 | $sel_data[5]<<16 | $sel_data[6]<<24)-$tfactor; + my $timestamp = ($sel_data[3] | $sel_data[4]<<8 | $sel_data[5]<<16 | $sel_data[6]<<24); + unless ($timestamp < 0x20000000) { + $timestamp -= $tfactor; + } my ($seldate,$seltime) = timestamp2datetime($timestamp); # $text = "$entry: $seldate $seltime"; $text = ":$seldate $seltime"; @@ -2719,7 +2722,10 @@ sub getoemevent { my $sel_data = shift; my $text=":"; if ($record_type < 0xE0 && $record_type > 0x2F) { #Should be timestampped, whatever it is - my $timestamp = (@$sel_data[3] | @$sel_data[4]<<8 | @$sel_data[5]<<16 | @$sel_data[6]<<24)-$tfactor; + my $timestamp = (@$sel_data[3] | @$sel_data[4]<<8 | @$sel_data[5]<<16 | @$sel_data[6]<<24); + unless ($timestamp < 0x20000000) { + $timestamp -= $tfactor; + } my ($seldate,$seltime) = timestamp2datetime($timestamp); my @rest = @$sel_data[7..15]; if ($mfg_id==2) { @@ -4423,6 +4429,9 @@ sub comp2int { sub timestamp2datetime { my $ts = shift; + if ($ts < 0x20000000) { + return "BMC Uptime",sprintf("%6d s",$ts); + } my @t = localtime($ts); my $time = strftime("%H:%M:%S",@t); my $date = strftime("%m/%d/%Y",@t);