summaryrefslogtreecommitdiffstats
path: root/libc/tzcode
Commit message (Collapse)AuthorAgeFilesLines
* Changes to re-enable overrides for tz dataNeil Fuller2015-03-251-5/+8
| | | | | Bug: 10637303 Change-Id: I5d525b66cf30d34b421803b876445596bed8d64d
* libc: Fix mktime returns an uncorrect time in empty TZ caseSatoru Takeuchi2014-11-141-0/+1
| | | | | | | | | | | | | The mktime API returned an uncorrect time when TZ is set as empty. A timezone UTC/GMT+0 should be implied in the empty case. However mktime keeps previous information about timezone. If mktime was called with a timezone which has DST before, the "defaulttype" member of "state" structure wouldn't be 0. Then it would be used next time, even though UTC/GMT+0 doesn't have DST. Added initialization of the "defaulttype" in the empty TZ case. Change-Id: Ic480c63c548c05444134e0aefb30a7b380e3f40b
* Disable tzdata in $ANDROID_DATA.Elliott Hughes2014-10-281-8/+5
| | | | | | | (cherry picked from 4c30130a2155c37e80af4c3b53bf4f6ce832e760.) Bug: 18139284 Change-Id: I2670dc1791d635139a5d39a438dc08777439476b
* Use snprintf(3) instead of sprintf(3).Dan Albert2014-10-081-1/+1
| | | | | | | This change should probably be made upstream as well, but they have a note about not using it because it isn't available on all systems. Change-Id: I6d8404c031bd2f486532ced55d94bbb4a4cd2e71
* Fix the tzdata update tools.Elliott Hughes2014-08-061-1/+1
| | | | | | | | | | | | | | | The recent libcore ZoneInfo changes mean that we can no longer compile libcore's ZoneInfo against the RI. Luckily, the field in our data file that we needed ZoneInfo for isn't actually used. This change removes our dependence on libcore. I've left the field in to avoid a file format change. We can remove the field if/when we next have a real need to bump the file format. (cherry-pick of 90cb5ffb85a9bc2e725824b3ca8db932d02c45db.) Bug: 16168653 Change-Id: Iedad2252c2b49f4d8bb2c7d9078b39b622444ca7
* Remove localtime_tz and strftime_tz.Elliott Hughes2014-07-252-124/+41
| | | | | | | | | This also brings our copy of strftime.c much closer to upstream, though we still have several GNU extensions and hacks to deal with Android32's broken time_t. Bug: 15765976 Change-Id: Ic9ef36e8acd3619504ecc4d73feec2b61fd4dfa1
* Start hiding "private/bionic_time.h".Elliott Hughes2014-07-252-10/+34
| | | | | Bug: 15765976 Change-Id: Ibd9cf07067ec8dffe9fda6c3d498d4ab90708220
* Build tzcode with hidden visibility.Elliott Hughes2014-06-192-3/+3
| | | | | Bug: 11156955 Change-Id: Ib98d837b56cbbdfd01687cb3054fe3103eec0da9
* Fix arm64 localtime.c build.Elliott Hughes2014-06-191-3/+3
| | | | | | I'm sick of having so many different compilers. Change-Id: I9088c38df2504e2b827d0ce5ba0fa551ae48f8f9
* Build tzcode with -Werror.Elliott Hughes2014-06-193-68/+59
| | | | | | | | Parts of this are just getting us in sync with upstream, but the 'const' stuff is our own mess. We should kill the *_tz functions and lose this difference from upstream. Change-Id: I17d26534ed3f54667143d78147a8c53be56d7b33
* Update localtime.c.Elliott Hughes2014-06-181-72/+85
| | | | | | | | | This brings us closer to upstream's ToT localtime.c; our main interest being their alternative fix for the stack usage we addressed in commit 8a8b0c9bfcd80c67154ed2aca1e60d815c822acb. Bug: 14468519 Change-Id: Ic28600115afda7f3158d91255edf422678bac082
* Fix most of the tzcode warnings.Elliott Hughes2014-06-111-7/+3
| | | | | | There's one left, but that's not fixed upstream yet. Change-Id: Iba920cb7b156357c7f5e8220eb55ff1637ff48a1
* Do not keep struct state on the stack.Christopher Ferris2014-05-141-22/+37
| | | | | | | | | | This structure is huge (~18000 bytes on arm64) and can blow out the stack very easily. Modify the code to allocate these structures instead of leaving them on the stack. Bug: 14468519 Change-Id: I774f71235d896d32a14ab1af06f95ca9ef819f52
* Switch to g_ for globals.Elliott Hughes2014-05-141-7/+7
| | | | | | | That's what the Google style guide recommends, and we're starting to get a mix. Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
* Fix <math.h> to quieten most of our warnings.Elliott Hughes2014-05-051-1/+1
| | | | | | | | | | | | | | | | | I've reported the wcsftime bug upstream, but we really just want to use -D to ensure the buggy code isn't built. (I've also brought our strftime a bit closer to upstream now we have the right define.) I don't think upstream is likely to fix all their sign-compare and uninitialized warnings, so let's just silence them. As for libm, again upstream isn't likely to fix all their warnings, and silencing those made the ones that were our fault stand out. I've fixed our <math.h> to fix the warnings caused by our lack of definitions for the non-imprecise long-double functions. I checked the C99 standard, and all these functions are there. Change-Id: Iee8e1182c1db375058fb2c451eceb212bab47a37
* Remove the non-standard time64 stuff for LP64.Elliott Hughes2014-05-051-0/+5
| | | | | | | We need a workaround in strftime as long as we still need to support 64-bit times on LP32. Change-Id: I8ffb616f6312d4063fb9ea3c36b52653e8f4c5f8
* Don't use so much stack in tzcode.Elliott Hughes2014-04-251-2/+22
| | | | | | Bug: 14313703 Bug: https://code.google.com/p/android/issues/detail?id=61130 Change-Id: Id9b240fce20d4a6f2660792070e02b2b5f287655
* Merge "Fix locatime.c indentation after sync"Calin Juravle2014-02-281-270/+270
|\
| * Fix locatime.c indentation after syncCalin Juravle2014-02-281-270/+270
| | | | | | | | | | Bug: 12246757 Change-Id: I8186e75f4899161af48cbf66e8f907dac0a326a2
* | Merge "Update tzcode to 2013i"Calin Juravle2014-02-283-105/+98
|\ \ | |/
| * Update tzcode to 2013iCalin Juravle2014-02-283-105/+98
| | | | | | | | | | Bug: 12246757 Change-Id: I3d5d2318155b1f54ef80afd58b1e5ca9a6d7018e
* | Vastly reduce the number of read(2)s done in tzload.Elliott Hughes2014-02-271-10/+24
|/ | | | | | | | | | | This costs us about 1000 fewer syscalls, which makes "adb shell strace date" a lot more readable (which is the reason I've been meaning to fix this for a long time now), but also actually saves a measurable amount of time. Longer-term we should try to keep the tzdata mmap(2)ed in like libcore does. Change-Id: I1dd9c81968a13d3a6a55ba17f8a7d5c1f38cd103
* Fix a leak on error in tzload.Elliott Hughes2014-02-271-3/+2
| | | | Change-Id: Ib5d9aaa7a618e478ce8e5e82f967cf535bb1a5a3
* Fix x86_64 build, clean up intermediate libraries.Elliott Hughes2013-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | The x86_64 build was failing because clone.S had a call to __thread_entry which was being added to a different intermediate .a on the way to making libc.so, and the linker couldn't guarantee statically that such a relocation would be possible. ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC This patch addresses that by ensuring that the caller and callee end up in the same intermediate .a. While I'm here, I've tried to clean up some of the mess that led to this situation too. In particular, this removes libc/private/ from the default include path (except for the DNS code), and splits out the DNS code into its own library (since it's a weird special case of upstream NetBSD code that's diverged so heavily it's unlikely ever to get back in sync). There's more cleanup of the DNS situation possible, but this is definitely a step in the right direction, and it's more than enough to get x86_64 building cleanly. Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
* Fix 32-bit build.Elliott Hughes2013-10-081-0/+2
| | | | | | | libc/tzcode/localtime.c: In function 'differ_by_repeat': libc/tzcode/localtime.c:338:2: error: comparison is always false due to limited range of data type [-Werror=type-limits] Change-Id: Ic84be6391a66e9d50ed98f41d865387c77a60ffa
* Upgrade to tzcode2013f plus Android modifications (from tzcode2013d plus ↵Elliott Hughes2013-09-275-83/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android modifications). localtime.c and strftime.c are still quite different from upstream because of our extensions, but the other files continue to be identical, and the two exceptions should be otherwise identical. From the tzcode2013e release notes: Changes affecting Godthab time stamps after 2037 if version mismatch Allow POSIX-like TZ strings where the transition time's hour can range from -167 through 167, instead of the POSIX-required 0 through 24. E.g., TZ='FJT-12FJST,M10.3.1/146,M1.3.4/75' for the new Fiji rules. This is a more-compact way to represent far-future time stamps for America/Godthab, America/Santiago, Antarctica/Palmer, Asia/Gaza, Asia/Hebron, Asia/Jerusalem, Pacific/Easter, and Pacific/Fiji. Other zones are unaffected by this change. (Derived from a suggestion by Arthur David Olson.) Allow POSIX-like TZ strings where daylight saving time is in effect all year. E.g., TZ='WART4WARST,J1/0,J365/25' for Western Argentina Summer Time all year. This supports a more-compact way to represent the 2013d data for America/Argentina/San_Luis. Because of the change for San Luis noted above this change does not affect the current data. (Thanks to Andrew Main (Zefram) for suggestions that improved this change.) Where these two TZ changes take effect, there is a minor extension to the tz file format in that it allows new values for the embedded TZ-format string, and the tz file format version number has therefore been increased from 2 to 3 as a precaution. Version-2-based client code should continue to work as before for all time stamps before 2038. Existing version-2-based client code (tzcode, GNU/Linux, Solaris) has been tested on version-3-format files, and typically works in practice even for time stamps after 2037; the only known exception is America/Godthab. Changes affecting API Support for floating-point time_t has been removed. It was always dicey, and POSIX no longer requires it. (Thanks to Eric Blake for suggesting to the POSIX committee to remove it, and thanks to Alan Barrett, Clive D.W. Feather, Andy Heninger, Arthur David Olson, and Alois Treindl, for reporting bugs and elucidating some of the corners of the old floating-point implementation.) The signatures of 'offtime', 'timeoff', and 'gtime' have been changed back to the old practice of using 'long' to represent UT offsets. This had been inadvertently and mistakenly changed to 'int_fast32_t'. (Thanks to Christos Zoulos.) The code avoids undefined behavior on integer overflow in some more places, including gmtime, localtime, mktime and zdump. Changes affecting code internals Minor changes pacify GCC 4.7.3 and GCC 4.8.1. Changes affecting documentation and commentary Documentation and commentary is more careful to distinguish UT in general from UTC in particular. (Thanks to Steve Allen.) From the tzcode2013f release notes: Changes affecting API The types of the global variables 'timezone' and 'altzone' (if present) have been changed back to 'long'. This is required for 'timezone' by POSIX, and for 'altzone' by common practice, e.g., Solaris 11. These variables were originally 'long' in the tz code, but were mistakenly changed to 'time_t' in 1987; nobody reported the incompatibility until now. The difference matters on x32, where 'long' is 32 bits and 'time_t' is 64. (Thanks to Elliott Hughes.) Change-Id: I14937c42a391ddb865e4d89f0783961bcc6baa21
* Use $ANDROID_DATA and $ANDROID_ROOT to find the tzdata.Elliott Hughes2013-09-191-4/+11
| | | | | | This lets us run binaries linked against bionic on an x86 host. Change-Id: Icd60cf99a90d747c77304c05b4f764e4d26af985
* Apply upstream commit 943a6621866e9d6e654f5cfe1494378c1fb8957a.Elliott Hughes2013-08-222-4/+14
| | | | | | | | | | | | | | Author: Paul Eggert <eggert@cs.ucla.edu> Date: Thu Aug 22 12:47:51 2013 -0700 * localtime.c: Fix another integer overflow bug in mktime. (time2sub): Avoid undefined behavior on time_t overflow. Reported by Elliott Hughes in <http://mm.icann.org/pipermail/tz/2013-August/019580.html>. Bug: 10310929 Change-Id: I3bf26f1f91371552e0a3828457d27e22af55acb2
* Upgrade to tzcode2013d.Elliott Hughes2013-07-126-884/+801
| | | | | | | | | | | | Well, kinda... localtime.c still contains a bunch of Android-specific hacks, as does strftime.c. But the other files are now exactly the same as upstream. This catches up with several years of bug fixes, and fixes most of the compiler warnings that were in this code. (Just two remain.) Bug: 1744909 Change-Id: I2ddfecb6fd408c847397c17afb0fff859e27feef
* Improve diagnostics in the face of bad tzdata.Elliott Hughes2013-04-251-5/+13
| | | | | Bug: 8373554 Change-Id: If8df5e956105e01cce95221ff0a7fa9d2b474db3
* Don't search off the end of the index for bad Olson ids.Elliott Hughes2013-03-141-1/+7
| | | | | | | | | | In the old code, the index was a file to itself, so it made sense to read until you hit the end of the file. In the new code, the index is followed by hundreds of KiB of data, so we need to just search the index. Bug: 8368791 Change-Id: Icf5f8b5516cf3a93679fa849c9f6cd1cb100e0f1
* Cache the most-recently used timezone for mktime_tz and localtime_tz.Elliott Hughes2013-03-111-27/+47
| | | | | | | | | | | | | | | Normally, the C library implicitly caches your timezone by virtue of the fact that the prehistoric API assumes a single timezone for the entire process. The unfortunate mktime_tz and localtime_tz extensions work around this, but represent timezones as strings to their callers, so code that makes heavy use of these needs a cache to be able to perform acceptably until it can hopefully one day be rewritten to use java.util.Calendar or icu4c. Bug: 8270865 Change-Id: I92e3964e86dc33ceac925f819cc5e26ff4203f50
* Revert "DO NOT MERGE Revert "Add the libcutils localtime_tz and mktime_t ↵Elliott Hughes2013-01-161-40/+87
| | | | | | extensions to bionic."" This reverts commit f4b34b6c3942be273ad7298a40be0d312b183aab.
* am f2b3ac95: Merge "Fix recovery: don\'t assert if there\'s no tzdata."Elliott Hughes2012-10-251-1/+3
|\ | | | | | | | | * commit 'f2b3ac9502e08ef53d4eedd7e93ea9a00d185055': Fix recovery: don't assert if there's no tzdata.
| * Fix recovery: don't assert if there's no tzdata.Elliott Hughes2012-10-251-1/+3
| | | | | | | | Change-Id: I4d808b57c63ec1ccc024da7fd6a65691e0d455c5
* | am df92635a: Merge "Support zone.tab in bionic, and remove the file format ↵Elliott Hughes2012-10-221-8/+1
|\ \ | |/ | | | | | | | | | | version." * commit 'df92635a57e8093d9cbffc38bbf513f3361ee91e': Support zone.tab in bionic, and remove the file format version.
| * Support zone.tab in bionic, and remove the file format version.Elliott Hughes2012-10-221-8/+1
| | | | | | | | | | Bug: 7012465 Change-Id: I6335c91ebadc609fae85bad94db972be7574b6e4
* | am eb370aa3: Merge "Make bionic look in /data/misc for tzdata updates."Elliott Hughes2012-10-221-22/+31
|\ \ | |/ | | | | | | * commit 'eb370aa31dd549ad7a7a2044dedab1140a7aeda9': Make bionic look in /data/misc for tzdata updates.
| * Make bionic look in /data/misc for tzdata updates.Elliott Hughes2012-10-221-22/+31
| | | | | | | | | | Bug: 7012465 Change-Id: I4d1018f686f2409600fdb6630732cae33efe8f02
* | am 10225071: Merge "Fixes x86 build."Elliott Hughes2012-10-181-1/+1
|\ \ | |/ | | | | | | * commit '102250719f8aff443741e54ba5633c7722544620': Fixes x86 build.
| * Fixes x86 build.Elliott Hughes2012-10-181-1/+1
| | | | | | | | Change-Id: I0e576784b2224668d58ebea03986d534ee0e43b4
* | am 5ae762a3: Merge "Pull bionic\'s time zone data from the new single ↵Elliott Hughes2012-10-181-39/+85
|\ \ | |/ | | | | | | | | | | \'tzdata\' file." * commit '5ae762a393168932602eb7269a7d30a53de1c83c': Pull bionic's time zone data from the new single 'tzdata' file.
| * Pull bionic's time zone data from the new single 'tzdata' file.Elliott Hughes2012-10-171-39/+85
| | | | | | | | | | Bug: 7012465 Change-Id: Iec71e448bf7a40af30ca89150b3c336e67a44a43
* | DO NOT MERGE Revert "Add the libcutils localtime_tz and mktime_t extensions ↵Elliott Hughes2012-09-241-87/+40
|/ | | | | | | | to bionic." This reverts commit 3a936a4980046a7eeb8d53a3296058d8f3a1f770. We don't want this in jb-mr1.
* Add the libcutils localtime_tz and mktime_t extensions to bionic.Elliott Hughes2012-09-111-40/+87
| | | | | Bug: 7012465 Change-Id: Ib66f061e29199ba134545111dc79f9b50c8f4a21
* libc: remove private declarations from <time.h> and <resolv.h>David 'Digit' Turner2012-01-131-0/+1
| | | | | | | | | | This patch is used to remove private C library declarations from the public headers (that are exported to the NDK). It should *only* be submitted after all other patches modifying the users of said private functions have been submitted to the tree, to avoid breakages. Change-Id: I0a5e3014f8e3ac9ed8df86a5cdae506337c23252
* am ac56f5ca: Merge "strftime: Use snprintf() instead of sprintf()"David Turner2011-06-231-2/+2
|\ | | | | | | | | * commit 'ac56f5ca2f4c54ddbd37b033f9465d89542c2cbe': strftime: Use snprintf() instead of sprintf()
| * strftime: Use snprintf() instead of sprintf()Jim Huang2011-06-231-2/+2
| | | | | | | | | | Change-Id: I112ac012894eddc96e5f3e77cb87bb300596e3ce Signed-off-by: Jim Huang <jserv@0xlab.org>
* | Bug 3330205 Thread safe strptime implementationGlenn Kasten2011-01-111-25/+27
|/ | | | Change-Id: I03e72b0253a7a2e015455ab81dbf155ed1e574d2
* <time.h>: Add timegm(), timelocal() and others.David 'Digit' Turner2010-12-061-2/+12
| | | | | | | Add timegm(), timelocal(), time2posix() and posix2time() to the C library. Change-Id: I34d5771ed83dd994870a5ca58a511d01898b1ffb