• Ben Murdoch's avatar
    Cherry pick android: fix base::Time::FromLocalExploded() crash. · 3919f93d
    Ben Murdoch authored
    Cherry pick of https://codereview.chromium.org/27472003/
    
    Bug: 11313033
    
    Original description:
    
    android: fix base::Time::FromLocalExploded() crash.
    
    This patch does the following:
    
    - Provide a work-around for an Android platform bug that
    happens on older Android releases (e.g. 4.1.2), but fixed
    on later ones (e.g. 4.3), where mktime() / mktime64()
    would return -1 even when passed proper time values.
    
    - Improve the code to properly deal with the fact that
    SysTime is actually int64 on Android, unlike other
    platforms, allowing us to remove the CHECK() that
    was triggered by the platform bug.
    
    - Add a new unit test to verify that the new code
    doesn't crash on Android 4.1.2 anymore, and returns
    the correct values.
    
    BUG=287821
    R=jar@chromium.org,mark@chromium.org,brettw@chromium.org
    
    Committed:
    https://src.chromium.org/viewvc/chrome?view=rev&revision=229567
    
    Change-Id: Icca4d67b827fbca14d6218493db776fb79db85b8
    3919f93d
time_unittest.cc 23.6 KB