-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NDK test (gtest.gtest_unittest, FormatEpochTimeInMillisAsIso8601) fails on KitKat devices #1604
Comments
gtest sets the time zone here: It calls localtime here: I wondered why it didn't use gmtime, but I think the idea is that FormatEpochTimeInMillisAsRFC3339 should report time strings in the local time zone, but when gtest is testing FormatEpochTimeInMillisAsRFC3339 itself, it needs to fix the time zone first so the result is consistent. |
i'm not sure i knew it was a regression at the time, but i do remember fixing a bug in that time period that's likely relevant ... there was a period where you needed to call tzset() if you changed the TZ environment variable. since then, we've automatically acted as if you called tzset(). so maybe that was true before then too? iirc it wasn't reported as a regression, but may have been? |
I don't think that's it?
|
I debugged it on KitKat, and I think the problem is that tzload handles For an arbitrary non-timezone random string, I did attempt to bisect the changes to localtime.c, but left
I think the upshot is that, on KitKat, to set the timezone to |
Either of these workarounds works: |
go with the NDK workaround for now, but send the gtest fix upstream, and cherrypick it if they accept it? |
It looks like upstream is happy with the workaround at http://cl/410688733 (though the automated tests seem to be failing). |
On KitKat, calling tzset with UTC+nn doesn't initialize all the timezone state. If the previous timezone was something like America/Chicago, then changing it to UTC+nn might have no effect. Setting the timezone to an intermediate value like "UTC" avoids the problem. Works around android/ndk#1604. PiperOrigin-RevId: 413050236 Change-Id: I99b2d3330ae68f1d58cd2ca278d3eaae30bd1e83
Was fixed in Lollipop, and we don't support kitkat any more. |
Some FormatEpochTimeInMillisAsIso8601 tests in gtest.gtest_unittest are failing for me on KitKat devices:
It seems there was a regression in KitKat involving timezone configuration. If the current timezone was configured using (a) an unset TZ variable or (b) a name like
America/Los_Angeles
, then trying to reconfigure the timezone using a string likeUTC+nn
has no effect. If there is an intermediate timezone configuration using an unrecognized string, then it can be finally configured usingUTC+nn
.AFAICT, it's fixed in Lollipop.
Test program:
JellyBean (generic_x86/sdk_x86/generic_x86:4.1.2/MASTER/eng.wdu.20191218.182616:eng/test-keys):
KitKat (generic_x86/sdk_x86/generic_x86:4.4.2/KK/4174703:eng/test-keys, google/razor/flo:4.4.4/KTU84P/1227136:user/release-keys):
Lollipop (generic_x86_64/sdk_phone_x86_64/generic_x86_64:5.0.2/LSY66K/4174711:eng/test-keys):
I did a brief look through the history of bionic/libc/tzcode through JB..KitKat..L but nothing popped out to me.
Before I tried
--no-time-zone--
, I triedUTC
, which also had the effect of making localtime use UTC time zone, but I don't know if that's becauseUTC
is special or whether it's just another unrecognized string.The text was updated successfully, but these errors were encountered: