1. 14 Feb, 2019 1 commit
    • 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
  2. 14 Sep, 2018 1 commit
  3. 04 Apr, 2018 1 commit
    • Jungshik Shin's avatar
      Reland "Implement a new spec for timezone offset calculation" · 1d3a87bd
      Jungshik Shin authored
      This is a reland of dbdede01
      after a webkit layout test (geolocation-api/timestamp.html) was
      fixed by
      https://chromium-review.googlesource.com/c/chromium/src/+/994343 .
      
      Original change's description:
      > Implement a new spec for timezone offset calculation
      >
      > https://github.com/tc39/ecma262/pull/778 was recently merged
      > to Ecma 262.
      >
      > It changes the way to convert between "local time" and UTC in such
      > a way that it'd work for all timezones whether or not there has
      > been any change in the timezone offset of the standard time. For
      > instance, Europe/Moscow and some parts of US state of Indiana have
      > changed the standard (non-DST) timezone offset a few times. The
      > previous spec assumes that the the standard timezone offset is
      > constant, but the new spec take into account the offset change
      > history.
      >
      > In addition, it specifies a new way to calculate the timezone
      > offset during a timezone transition (either in and
      > out of DST or timezone offset shift).
      >
      > During a negative transition (e.g.  fall backward / getting
      > out of DST), repeated times are to be interpreted as if the
      > offset before the transition is in effect.
      >
      > During a positive transition (e.g. spring forward / getting
      > into DST), skipped times are to be treated similarly. That
      > is, they are to be interpreted as if the offset before the
      > transition is in effect.
      >
      > With icu-timezone-data, v8 is compliant to the new spec for the
      > past and the future as well as now whether or not the standard
      > timezone offset of a given timezone has changed over time
      > (e.g. Europe/Moscow, Pacific/Apia). With icu-timezone-data,
      > Australia/Lord_Howe (30 minute DST change) also works per spec.
      >
      > Without icu-timezone-data, it works only for timezones of which
      > the standard timezone offset is the same as the current offset
      > (e.g. most North American timezones other than parts of Indiana)
      > and of which the DST shift is an hour. For instance, it doesn't work
      > for Europe/Moscow in 2010 when the standard timezone offset was
      > +4h because the current (2018) standard timezone offset is +3h. Neither
      > does it for Lord Howe in Australia with the DST shift of 0.5 hr.
      >
      > This CL used to require one of the two ICU CLs below, but not
      > any more.
      >
      >   https://chromium-review.googlesource.com/c/chromium/deps/icu/+/572652
      >   https://chromium-review.googlesource.com/851265  (a proposed CL to the
      >   upstream ICU).
      >
      > Bug: v8:3547,chromium:417640,v8:5714
      > Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
      > Change-Id: Ib162295da5bee31b2390bd0918157014aebd3e33
      > Reviewed-on: https://chromium-review.googlesource.com/572148
      > Commit-Queue: Jungshik Shin <jshin@chromium.org>
      > Reviewed-by: Daniel Ehrenberg <littledan@chromium.org>
      > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#52332}
      
      Bug: v8:3547, chromium:417640, v8:5714
      Change-Id: I47536c111143f75e3cfeecf5d9761c43a98a10f5
      Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
      Reviewed-on: https://chromium-review.googlesource.com/995971
      Commit-Queue: Jungshik Shin <jshin@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52372}
      1d3a87bd
  4. 03 Apr, 2018 2 commits
    • Clemens Hammacher's avatar
      Revert "Implement a new spec for timezone offset calculation" · 965edc0e
      Clemens Hammacher authored
      This reverts commit dbdede01.
      
      Reason for revert: Fails webkit_tests, blocks roll: https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064
      
      Original change's description:
      > Implement a new spec for timezone offset calculation
      > 
      > https://github.com/tc39/ecma262/pull/778 was recently merged
      > to Ecma 262.
      > 
      > It changes the way to convert between "local time" and UTC in such
      > a way that it'd work for all timezones whether or not there has
      > been any change in the timezone offset of the standard time. For
      > instance, Europe/Moscow and some parts of US state of Indiana have
      > changed the standard (non-DST) timezone offset a few times. The
      > previous spec assumes that the the standard timezone offset is
      > constant, but the new spec take into account the offset change
      > history.
      > 
      > In addition, it specifies a new way to calculate the timezone
      > offset during a timezone transition (either in and
      > out of DST or timezone offset shift).
      > 
      > During a negative transition (e.g.  fall backward / getting
      > out of DST), repeated times are to be interpreted as if the
      > offset before the transition is in effect.
      > 
      > During a positive transition (e.g. spring forward / getting
      > into DST), skipped times are to be treated similarly. That
      > is, they are to be interpreted as if the offset before the
      > transition is in effect.
      > 
      > With icu-timezone-data, v8 is compliant to the new spec for the
      > past and the future as well as now whether or not the standard
      > timezone offset of a given timezone has changed over time
      > (e.g. Europe/Moscow, Pacific/Apia). With icu-timezone-data,
      > Australia/Lord_Howe (30 minute DST change) also works per spec.
      > 
      > Without icu-timezone-data, it works only for timezones of which
      > the standard timezone offset is the same as the current offset
      > (e.g. most North American timezones other than parts of Indiana)
      > and of which the DST shift is an hour. For instance, it doesn't work
      > for Europe/Moscow in 2010 when the standard timezone offset was
      > +4h because the current (2018) standard timezone offset is +3h. Neither
      > does it for Lord Howe in Australia with the DST shift of 0.5 hr.
      > 
      > This CL used to require one of the two ICU CLs below, but not
      > any more.
      > 
      >   https://chromium-review.googlesource.com/c/chromium/deps/icu/+/572652
      >   https://chromium-review.googlesource.com/851265  (a proposed CL to the
      >   upstream ICU).
      > 
      > Bug: v8:3547,chromium:417640,v8:5714
      > Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
      > Change-Id: Ib162295da5bee31b2390bd0918157014aebd3e33
      > Reviewed-on: https://chromium-review.googlesource.com/572148
      > Commit-Queue: Jungshik Shin <jshin@chromium.org>
      > Reviewed-by: Daniel Ehrenberg <littledan@chromium.org>
      > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#52332}
      
      TBR=adamk@chromium.org,littledan@chromium.org,mlippautz@chromium.org,jshin@chromium.org
      
      Change-Id: I6b3bf4427c761b106280d565a3912cd8e25cf87e
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Bug: v8:3547, chromium:417640, v8:5714
      Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
      Reviewed-on: https://chromium-review.googlesource.com/994192Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52338}
      965edc0e
    • Jungshik Shin's avatar
      Implement a new spec for timezone offset calculation · dbdede01
      Jungshik Shin authored
      https://github.com/tc39/ecma262/pull/778 was recently merged
      to Ecma 262.
      
      It changes the way to convert between "local time" and UTC in such
      a way that it'd work for all timezones whether or not there has
      been any change in the timezone offset of the standard time. For
      instance, Europe/Moscow and some parts of US state of Indiana have
      changed the standard (non-DST) timezone offset a few times. The
      previous spec assumes that the the standard timezone offset is
      constant, but the new spec take into account the offset change
      history.
      
      In addition, it specifies a new way to calculate the timezone
      offset during a timezone transition (either in and
      out of DST or timezone offset shift).
      
      During a negative transition (e.g.  fall backward / getting
      out of DST), repeated times are to be interpreted as if the
      offset before the transition is in effect.
      
      During a positive transition (e.g. spring forward / getting
      into DST), skipped times are to be treated similarly. That
      is, they are to be interpreted as if the offset before the
      transition is in effect.
      
      With icu-timezone-data, v8 is compliant to the new spec for the
      past and the future as well as now whether or not the standard
      timezone offset of a given timezone has changed over time
      (e.g. Europe/Moscow, Pacific/Apia). With icu-timezone-data,
      Australia/Lord_Howe (30 minute DST change) also works per spec.
      
      Without icu-timezone-data, it works only for timezones of which
      the standard timezone offset is the same as the current offset
      (e.g. most North American timezones other than parts of Indiana)
      and of which the DST shift is an hour. For instance, it doesn't work
      for Europe/Moscow in 2010 when the standard timezone offset was
      +4h because the current (2018) standard timezone offset is +3h. Neither
      does it for Lord Howe in Australia with the DST shift of 0.5 hr.
      
      This CL used to require one of the two ICU CLs below, but not
      any more.
      
        https://chromium-review.googlesource.com/c/chromium/deps/icu/+/572652
        https://chromium-review.googlesource.com/851265  (a proposed CL to the
        upstream ICU).
      
      Bug: v8:3547,chromium:417640,v8:5714
      Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
      Change-Id: Ib162295da5bee31b2390bd0918157014aebd3e33
      Reviewed-on: https://chromium-review.googlesource.com/572148
      Commit-Queue: Jungshik Shin <jshin@chromium.org>
      Reviewed-by: 's avatarDaniel Ehrenberg <littledan@chromium.org>
      Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52332}
      dbdede01
  5. 03 Mar, 2017 1 commit
    • littledan's avatar
      [date] Refactor TimezoneCache to be separate from the OS · ccfe50b9
      littledan authored
      This refactoring is preparatory work to enable ICU to be the backend
      for timezone information rather than system calls. In the process, a
      bit of code duplication that was inserted in the Solaris port patch is
      eliminated here among modern POSIX backends.
      
      One possible performance downside of this patch is that it introduces
      a virtual method call for operations which were previously not virtual
      methods. However, a couple factors mitigate this effect:
      - The DateCache minimizes the need for calls into the TimezoneCache
      - These calls were already not very high performance, as they included
        a system call which requires an RPC to get out of the sandbox, and
        they are surrounded by C++ builtins, which require a JS to C++
        transition.
      - A future transition to ICU, enabled by this refactoring, may improve
        performance by eliminating the system call.
      
      BUG=v8:6031
      
      Review-Url: https://codereview.chromium.org/2731463003
      Cr-Commit-Position: refs/heads/master@{#43588}
      ccfe50b9