Date: Fri, 18 Jun 2004 17:01:09 +0200 From: Cyrille Lefevre <cyrille.lefevre@laposte.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/68081: sys/time.h (lint fix) Message-ID: <20040618150109.GA4394@gits.dyndns.org> Resent-Message-ID: <200406181510.i5IFAOKs015312@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 68081 >Category: kern >Synopsis: sys/time.h (lint fix) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Jun 18 15:10:24 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 5.2-CURRENT i386 >Organization: ACME >Environment: System: FreeBSD gits 5.2-CURRENT FreeBSD 5.2-CURRENT #29: Mon May 31 01:35:59 CEST 2004 root@gits:/disk3/freebsd/current/obj/disk3/freebsd/current/src/sys/CUSTOM i386 >Description: see below. >How-To-Repeat: cat << EOF > c.c #include <sys/time.h> EOF lint -cghapbx c.c time.h(112): warning: conversion from 'unsigned long long' may lose accuracy [132] time.h(129): warning: conversion from 'unsigned long long' may lose accuracy [132] time.h(136): warning: conversion from 'long' may lose accuracy [132] ... >Fix: Index: time.h =================================================================== RCS file: /home/ncvs/src/sys/sys/time.h,v retrieving revision 1.65 diff -u -I$Id.*$ -I$.+BSD.*$ -r1.65 time.h --- time.h 7 Apr 2004 04:19:49 -0000 1.65 +++ time.h 18 Jun 2004 14:54:36 -0000 @@ -109,7 +109,7 @@ { ts->tv_sec = bt->sec; - ts->tv_nsec = ((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32; + ts->tv_nsec = (uint32_t)(((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32); } static __inline void @@ -126,14 +126,14 @@ { tv->tv_sec = bt->sec; - tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32; + tv->tv_usec = (uint32_t)(((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32); } static __inline void timeval2bintime(const struct timeval *tv, struct bintime *bt) { - bt->sec = tv->tv_sec; + bt->sec = (time_t)tv->tv_sec; /* 18446744073709 = int(2^64 / 1000000) */ bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040618150109.GA4394>