[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/45741: tcsh doesn't understand 64bit time_t
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 wrote:
> > 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 |