• Hannu Trey's avatar
    Re-detect the host time zone if requested by an embedder · f781f522
    Hannu Trey authored
    Add an enum argument to DateTimeConfigurationChangeNotification to
    control whether or not to redetect the host time zone. The default value
    kSkip doesn't cause redetecting so that callers do not need to change if
    they want the current behavior (e.g. Chromium).
    
    Note that the host time zone detection does not work when v8 is run
    inside a sandbox as in Chromium so that Chromium detects the host time
    zone outside the sandbox before calling
    DateTimeConfigurationChangeNotification. OTOH, other v8 embedders may
    find it more convenient for v8 to do the host time zone detection on
    their behalf. In that case, they can call the function with the new
    argument set to value kRedetect.
    
    Test:
    With PHP+V8Js on linux, execute:
    php -r '
      putenv("TZ=Europe/Helsinki");
      $v8 = new V8Js();
      $v8->executeString("print((new Date(0)).toString()+\"\\n\");");
      putenv("TZ=America/New_York");
      $v8->executeString("print((new Date(0)).toString()+\"\\n\");");'
    
    Result before modification:
    Thu Jan 01 1970 02:00:00 GMT+0200 (Eastern European Standard Time)
    Thu Jan 01 1970 02:00:00 GMT+0200 (Eastern European Standard Time)
    
    Result after modification:
    Thu Jan 01 1970 02:00:00 GMT+0200 (Eastern European Standard Time)
    Thu Jan 01 1970 02:00:00 GMT+0200 (Eastern European Standard Time)
    
    Result after V8JS is modified to use value kRedetect when calling
    
    Thu Jan 01 1970 02:00:00 GMT+0200 (Eastern European Standard Time)
    Wed Dec 31 1969 19:00:00 GMT-0500 (Eastern Standard Time)
    
    DateTimeConfigurationChangeNotification: 
    Change-Id: I005192dd42669a94f606a49baa9eafad3475b9fd
    Reviewed-on: https://chromium-review.googlesource.com/c/1449637Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Reviewed-by: 's avatarJungshik Shin <jshin@chromium.org>
    Commit-Queue: Jungshik Shin <jshin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#59613}
    f781f522
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...