From patchwork Wed Apr 30 14:35:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4094481 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CD225BFF02 for ; Wed, 30 Apr 2014 14:35:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1799C20265 for ; Wed, 30 Apr 2014 14:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 248FF202F8 for ; Wed, 30 Apr 2014 14:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933593AbaD3Ofo (ORCPT ); Wed, 30 Apr 2014 10:35:44 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:33564 "EHLO mail-we0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933466AbaD3Ofm (ORCPT ); Wed, 30 Apr 2014 10:35:42 -0400 Received: by mail-we0-f173.google.com with SMTP id w61so1754501wes.18 for ; Wed, 30 Apr 2014 07:35:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=ZGsWqUrGods0RHWRGy8phoUBZCEEQMAwKdc5tPctuxE=; b=WVTtqoVblW8FSsPlGeyxGWrdy0XRpZs04/n3TbLZMsKme36fHMar1STBAMpbmP7Q4T 7LN8VF2ZlisgB99vTT77sxpwQbRiNf7mPlkas/UE4e02DxfThyGMW7egVR1Dvej1RxEm MsJ8sP2rflehjBpNZp3qk7OVF46yyNMqjleyJyyoe8Of7NAMcGU85NS2QULqsRBR0O8b kFovlPQE6hgL3rPAWw5ttvseLuPO5hmCFDHgdcrr0lFwRpqpMWYfD4fgORf3qPV2GHoj ooKwImGXTla+HqSLfVttpjz8XlNBx2DveXtlDWQuM4xoBFNeQnetKvUgVa8eSHxv1lzS OD1A== X-Gm-Message-State: ALoCoQk1dxCuCA/QMt47j4/hhC0RVNphMGSuwmcTB61aFtR87Y1yrGHByZMDoH7e9I0TSMWByjFd X-Received: by 10.181.8.204 with SMTP id dm12mr3966840wid.1.1398868541195; Wed, 30 Apr 2014 07:35:41 -0700 (PDT) Received: from [10.223.0.94] (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id lj15sm4015543wic.13.2014.04.30.07.35.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 07:35:40 -0700 (PDT) Message-ID: <53610A3B.1040109@dev.mellanox.co.il> Date: Wed, 30 Apr 2014 10:35:39 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Tomer Cohen Subject: [PATCH opensm] osm_log.c: Fix wrong hour and date display in log when CL_ASSERT fail Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tomer Cohen using gettimeofday function instead of cl_get_time_stamp Signed-off-by: Tomer Cohen Signed-off-by: Hal Rosenstock --- opensm/osm_log.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/opensm/osm_log.c b/opensm/osm_log.c index 3460cc5..29e80e4 100644 --- a/opensm/osm_log.c +++ b/opensm/osm_log.c @@ -230,6 +230,7 @@ void osm_log_v2(IN osm_log_t * p_log, IN osm_log_level_t verbosity, SYSTEMTIME st; uint32_t pid = GetCurrentThreadId(); #else + struct timeval tv; pid_t pid = 0; time_t tim; struct tm result; @@ -294,7 +295,9 @@ _retry: st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, pid, verbosity, buffer); #else - time_usecs = cl_get_time_stamp(); + gettimeofday(&tv, NULL); + /* Convert the time of day into a microsecond timestamp */ + time_usecs = ((uint64_t) tv.tv_sec * 1000000) + (uint64_t) tv.tv_usec; tim = time_usecs / 1000000; usecs = time_usecs % 1000000; localtime_r(&tim, &result);