From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 16 22:15:58 2014 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 47C5A455 for ; Thu, 16 Oct 2014 22:15:58 +0000 (UTC) Received: from mail-vc0-x235.google.com (mail-vc0-x235.google.com [IPv6:2607:f8b0:400c:c03::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B23A948 for ; Thu, 16 Oct 2014 22:15:57 +0000 (UTC) Received: by mail-vc0-f181.google.com with SMTP id le20so3485866vcb.12 for ; Thu, 16 Oct 2014 15:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=T1kiNWZ1wFy1O1hLkSUGsL2Su7qzIKddR2KqdzKKUf0=; b=i0qOY3QRP5mml1SgGXQiC9Vy2CZaj1aMD79KzIJMy9y0ul4QTuYnxJhDP8da5qidPk p5C4sk2aM5E5ZUOPBK0M6yF0UQa78xYEpw8mZlVJ4fiCQ6CXX3ZHiVfWxQ8GSRzYX2V1 bKuvtnr6q5I2J7IlefeBbQ7arLeeqYaW8+ZIKV2H4H6fBRFBidwJ/eBoX+UI7faP5rf/ 87DCQz95c3dYdY6xgI+F1EleJg4FcAZMK4Cea80i8fKR/Tb2aCl8EeZqZlzpAVHz4/i8 T3bv2kWvLwx6tLKNCaUl2WX7ma6ZvoVNyOtAYjvJoPcjEFhZ+3T3sfkuPvBK6SuDQ/2W E2Ng== MIME-Version: 1.0 X-Received: by 10.52.167.195 with SMTP id zq3mr3493554vdb.44.1413497757077; Thu, 16 Oct 2014 15:15:57 -0700 (PDT) Sender: jlehen@gmail.com Received: by 10.31.136.79 with HTTP; Thu, 16 Oct 2014 15:15:57 -0700 (PDT) Date: Fri, 17 Oct 2014 00:15:57 +0200 X-Google-Sender-Auth: v5weWoheibH60JIOUbkQIEZynSQ Message-ID: Subject: struct bintime From: Jeremie Le Hen To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2014 22:15:58 -0000 Hi, I need to get microseconds from a struct bintime. I found bintime2timeval() in sys/time.h which more or less does this, but I don't understand how the computation works. Can someone explain it to me please? static __inline void bintime2timeval(const struct bintime *_bt, struct timeval *_tv) { _tv->tv_sec = _bt->sec; _tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(_bt->frac >> 32)) >> 32; } Thanks! -- Jeremie Le Hen jlh@FreeBSD.org