• 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
..
OWNERS Loading commit data...
condition-variable.cc Loading commit data...
condition-variable.h Loading commit data...
elapsed-timer.h Loading commit data...
mutex.cc Loading commit data...
mutex.h Loading commit data...
platform-aix.cc Loading commit data...
platform-cygwin.cc Loading commit data...
platform-freebsd.cc Loading commit data...
platform-fuchsia.cc Loading commit data...
platform-linux.cc Loading commit data...
platform-macos.cc Loading commit data...
platform-openbsd.cc Loading commit data...
platform-posix-time.cc Loading commit data...
platform-posix-time.h Loading commit data...
platform-posix.cc Loading commit data...
platform-posix.h Loading commit data...
platform-qnx.cc Loading commit data...
platform-solaris.cc Loading commit data...
platform-win32.cc Loading commit data...
platform.h Loading commit data...
semaphore.cc Loading commit data...
semaphore.h Loading commit data...
time.cc Loading commit data...
time.h Loading commit data...