From 4e9ace58c2704aa479abc22ea7d79817aff75229 Mon Sep 17 00:00:00 2001 From: imp Date: Fri, 19 Jan 2007 01:16:35 +0000 Subject: On FreeBSD/arm, any value > 50 bits will result in a rediculously huge number being returned for mktime and timegm calls. Choose 48 because that works well. This does reduce the dynamic range of tm_year from about 2 billion years down to "only" about 9 million years. Please contact me if this restriction poses a problem. Due to the complexity of the code, I admit that I didn't trace down what, exactly, was overflowing with longer bits. This fixes software that we run on the embedded systems we have. --- lib/libc/stdtime/localtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index d7b5a36..827b140 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1518,8 +1518,8 @@ const int do_norm_secs; ** If we have more than this, we will overflow tm_year for tmcomp(). ** We should really return an error if we cannot represent it. */ - if (bits > 56) - bits = 56; + if (bits > 48) + bits = 48; /* ** If time_t is signed, then 0 is just above the median, ** assuming two's complement arithmetic. -- cgit v1.1