[uClibc-cvs] [uClibc 0000336]: [PATCH] strftime() returns invalid timezone
bugs at busybox.net
bugs at busybox.net
Wed Jul 27 00:51:57 UTC 2005
The following issue has been CLOSED
======================================================================
http://busybox.net/bugs/view.php?id=336
======================================================================
Reported By: jean2
Assigned To: uClibc
======================================================================
Project: uClibc
Issue ID: 336
Category: Other
Reproducibility: always
Severity: major
Priority: normal
Status: closed
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 07-11-2005 11:20 PDT
Last Modified: 07-26-2005 17:51 PDT
======================================================================
Summary: [PATCH] strftime() returns invalid timezone
Description:
Hi,
When compiled with TM_EXTENSIONS, the strftime() function in
uClibc gives invalid timezone information. This has wide implication,
as most time functions on the system will display invalid timezone.
To visualise the bug, let's compare x86-glibc with arm-uClibc :
----- x86-blic --------------------------------
# date -u -R
Mon, 11 Jul 2005 17:32:20 +0000
# date -R
Mon, 11 Jul 2005 10:32:21 -0700
-----------------------------------------------
----- arm-uClibc --------------------------------------------
# ntpdate ntp3a
11 Jul 10:32:10 ntpdate[243]: step time server 15.X.X.X offset
1121103095.847544 sec
# date -u -R
Mon, 11 Jul 2005 17:32:26 GMT
# date -R
Mon, 11 Jul 2005 10:32:27 +0700
-------------------------------------------------------------
As you can see, the time is correct, which indicates that the
timezone is properly configured, however, the timezone is incorrect.
To understand the bug, consider this :
---- localtime() -------------------------------
#ifdef __UCLIBC_HAS_TM_EXTENSIONS__
result->tm_gmtoff = - tzi[dst].gmt_offset;
#endif /* __UCLIBC_HAS_TM_EXTENSIONS__ */
-------------------------------------------------
and :
---- strftime() ---------------------------------
#ifdef __UCLIBC_HAS_TM_EXTENSIONS__
#define RSP_GMT_OFFSET timeptr->tm_gmtoff
#else
#define RSP_GMT_OFFSET rsp->gmt_offset
#endif
*s = '+';
if ((tzo = -RSP_GMT_OFFSET) < 0) {
tzo = -tzo;
*s = '-';
}
-------------------------------------------------
Patch to fix the bug is attached (see attachement), and quite
trivial. Patch tested with uClibc-0.9.27 on ARM with BusyBox date. A
casual look at the latest CVS indicates that the patch is still needed
and would apply fine.
Note that I did not check if the same problem is present
elsewhere, however it looks like TM_EXTENSIONS are not used in other
places.
Have fun...
Jean
======================================================================
----------------------------------------------------------------------
vapier - 07-11-05 20:17
----------------------------------------------------------------------
maybe related to Bug 74
----------------------------------------------------------------------
jean2 - 07-12-05 14:24
----------------------------------------------------------------------
> maybe related to Bug 74
Nope, totally unrelated. This bug only affect the display of the
timezone info in a string, not the timezone calculations themselves nor
the display of the time.
In any case, it's easy enough to verify, just forward the patch
attached to this bug to the other bug reporter...
Jean
Issue History
Date Modified Username Field Change
======================================================================
07-11-05 11:20 jean2 New Issue
07-11-05 11:20 jean2 File Added: uClibc-strftime-timezone-2.patch
07-11-05 20:17 vapier Note Added: 0000281
07-12-05 14:24 jean2 Note Added: 0000283
07-26-05 17:51 mjn3 Status assigned => closed
07-26-05 17:51 mjn3 Resolution open => fixed
======================================================================
More information about the uClibc-cvs
mailing list