[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/45741: tcsh doesn't understand 64bit time_t
The following reply was made to PR pkg/45741; it has been noted by GNATS.
From: Michael van Elst <mlelstv%serpens.de@localhost>
Cc: pkg-manager%NetBSD.org@localhost, gnats-admin%NetBSD.org@localhost,
Subject: Re: pkg/45741: tcsh doesn't understand 64bit time_t
Date: Sun, 25 Dec 2011 13:34:51 +0100
On Sun, Dec 25, 2011 at 12:15:04PM +0000, David Holland wrote:
> On Sun, Dec 25, 2011 at 10:10:01AM +0000, mlelstv%serpens.de@localhost
> > tcsh 6.17 prints bad values for user and system time. This is caused
> > by the change to 64bit time_t values in NetBSD.
> Is that a compat problem or a native problem? (that is, did you build
> the tcsh before or after the time_t switch?)
Of course after.
The problem is that printf is called with a format string
denoting a 'long' value, but gets passed a parameter that is
'time_t'. This works fine unless 'time_t' is larger than 'long'.
Casting the parameters to 'long' helps unless the value
printed doesn't fit into a 'long' (i.e. rusage is more than
2^31 seconds == 68 years CPU time).
If you want to support larger rusage values, the format string
needs to be adapted. But that might have portability issues for
Michael van Elst
"A potential Snark may lurk in every tree."
Main Index |
Thread Index |