httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bennett, Tony - CNF" <Bennett.T...@cnf.com>
Subject RE: Problem with apr_time_exp_lt (localtime_r) on AIX
Date Wed, 01 Mar 2006 15:51:37 GMT
lekha,
 
Firstly apr_time_exp_lt() is just a wrapper around the
native UNIX (aix) calls, and is therefore subject to 
all of UNIX's limitations.
 
The problem is that UNIX has a know date limit which is 
        Tue, 19 Jan 2038 03:14:07 GMT
 
The reason for this is that a time_t is a 32 bit signed number.  
The maximum positive value that can be represented in one is
2147483647. 
 
The reason you have a problem and others don't is 
your timezone.  To convert to local time, you have to 
add your timezone offset (or in my case subtract my
timezone offset) from GMT.  (This is what localtime
does.)  
 
You are 5 hours ahead of GMT, so you would 
add (5 * 60 * 60) 18,000 seconds to the time_t variable... 
thereby overflowing it...
Its hex contents become: 0x8000464f which is 
-2147465649....
 
-tony
 


________________________________

From: Lekha Menon [mailto:lekha.menon@patni.com] 
Sent: Wednesday, March 01, 2006 12:18 AM
To: dev@httpd.apache.org
Subject: Re: Problem with apr_time_exp_lt (localtime_r) on AIX


Sorry.The test program worked fine. However, call to API
apr_time_exp_lt () fails. It returns  year1  with 2147483647000000.
When iput is 2147000000000000, it returns year as 138. My local time
zone setting is PAKST (GMT +5). 
 
Is this causing the problem?
 
Thanks & Regards,
Lekha Menon
Extn - 5329

 
----- Original Message ----- 

	From: Bennett, Tony - CNF <mailto:Bennett.Tony@cnf.com>  
	To: dev@httpd.apache.org 
	Sent: Tuesday, February 28, 2006 9:51 PM
	Subject: RE: Problem with apr_time_exp_lt (localtime_r) on AIX

	Lekha,
	 
	I wrote the sample program below, and ran it on both AIX 4.3.3 &
AIX 5.1
	in both threaded and unthreaded mode (xlc vs. xlc_r compiler).
	In both cases it returned 138.
	 
	#ifdef _THREAD_SAFE
	#include <pthread.h>
	#endif
	 
	#include <stdio.h>
	#include <time.h>
	 
	main()
	{
	    struct tm  wk_localtime;
	    struct tm *my_localtime;
	 
	    time_t  my_time = 2147483647;
	 
	    #ifdef _THREAD_SAFE
	 
	    memset(&wk_localtime, '\0', sizeof(wk_localtime));
	    my_localtime = localtime_r(&my_time, &wk_localtime);
	 
	    #else
	 
	    my_localtime = localtime(&my_time);
	    #endif
	 
	    printf("my_localtime->tm_year=%hd\n",
my_localtime->tm_year);
	}
	
	 

________________________________

	From: Lekha Menon [mailto:lekha.menon@patni.com] 
	Sent: Tuesday, February 28, 2006 4:57 AM
	To: dev@httpd.apache.org
	Subject: Problem with apr_time_exp_lt (localtime_r) on AIX
	
	
	Hi,
	 
	I am facing a strange problem with apr_time_exp_lt.
	 
	On AIX, when i call apr_time_exp_lt with 2nd arg as
2147483647000000LL, it sets the yr as 1 instead on 138. 
	 
	The same works on Linux properly.
	 
	I investigated the code & found that apr_time_exp_lt internally
calls explode_time().
	 
	Here, localtime_r is called with arguments (&tt, &tm) where
tt=2147483647.
	 
	localtime_r seems to be having some issue!
	 
	For checking localtime_r, i wrote a sample program. There also,
while passing tt=2147483647, it returned  1 instead of 138.
	 
	Is this AIX specific?
	 
	Please help!
	 
	Thanks in adv!
	 
	Regards,
	Lekha
	 

	http://www.patni.com
	World-Wide Partnerships. World-Class Solutions. 
	
_____________________________________________________________________ 
	
	This e-mail message may contain proprietary, confidential or
legally privileged information for the sole use of the person or entity
to whom this message was originally addressed. Any review,
e-transmission dissemination or other use of or taking of any action in
reliance upon this information by persons or entities other than the
intended recipient is prohibited. If you have received this e-mail in
error kindly delete this e-mail from your records. If it appears that
this mail has been forwarded to you without proper authority, please
notify us immediately at netadmin@patni.com and delete this mail. 
	
_____________________________________________________________________ 


http://www.patni.com
World-Wide Partnerships. World-Class Solutions. 
_____________________________________________________________________ 

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to whom
this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@patni.com and delete this mail. 
_____________________________________________________________________ 

Mime
View raw message