Rebase Always-use-the-equivalent-year-to-determine-the-time-zone patch

This commit is contained in:
František Zatloukal 2019-04-14 22:39:46 +02:00
parent ca946228cd
commit a1b605c73f
1 changed files with 71 additions and 69 deletions

View File

@ -9,23 +9,22 @@ Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1479687
Origin: upstream Origin: upstream
Applied-upstream: 62, commit:https://hg.mozilla.org/mozilla-central/rev/ce9f1466ec78 Applied-upstream: 62, commit:https://hg.mozilla.org/mozilla-central/rev/ce9f1466ec78
--- ---
js/src/jsdate.cpp | 12 ++++++++---- js/src/jsdate.cpp | 11 +++++++----
js/src/vm/Time.cpp | 14 ++++---------- js/src/vm/Time.cpp | 14 ++++----------
js/src/vm/Time.h | 2 +- js/src/vm/Time.h | 2 +-
3 files changed, 13 insertions(+), 15 deletions(-) 3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp
index b7f49e7..f32a853 100644 index 07af3d18c865..ff8fd6c3763c 100644
--- a/js/src/jsdate.cpp --- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp
@@ -2684,12 +2684,16 @@ static size_t @@ -2353,12 +2353,15 @@ static PRMJTime ToPRMJTime(double localTime, double utcTime) {
FormatTime(char* buf, int buflen, const char* fmt, double utcTime, double localTime) static size_t FormatTime(char* buf, int buflen, const char* fmt, double utcTime,
{ double localTime) {
PRMJTime prtm = ToPRMJTime(localTime, utcTime); PRMJTime prtm = ToPRMJTime(localTime, utcTime);
- int eqivalentYear = IsRepresentableAsTime32(utcTime) - int eqivalentYear = IsRepresentableAsTime32(utcTime)
- ? prtm.tm_year - ? prtm.tm_year
- : EquivalentYearForDST(prtm.tm_year); - : EquivalentYearForDST(prtm.tm_year);
+
+ // If an equivalent year was used to compute the date/time components, use + // If an equivalent year was used to compute the date/time components, use
+ // the same equivalent year to determine the time zone name and offset in + // the same equivalent year to determine the time zone name and offset in
+ // PRMJ_FormatTime(...). + // PRMJ_FormatTime(...).
@ -34,25 +33,25 @@ index b7f49e7..f32a853 100644
+ : EquivalentYearForDST(prtm.tm_year); + : EquivalentYearForDST(prtm.tm_year);
int offsetInSeconds = (int)floor((localTime - utcTime) / msPerSecond); int offsetInSeconds = (int)floor((localTime - utcTime) / msPerSecond);
- return PRMJ_FormatTime(buf, buflen, fmt, &prtm, eqivalentYear, offsetInSeconds); - return PRMJ_FormatTime(buf, buflen, fmt, &prtm, eqivalentYear,
+ return PRMJ_FormatTime(buf, buflen, fmt, &prtm, timeZoneYear, offsetInSeconds); + return PRMJ_FormatTime(buf, buflen, fmt, &prtm, timeZoneYear,
offsetInSeconds);
} }
enum class FormatSpec {
diff --git a/js/src/vm/Time.cpp b/js/src/vm/Time.cpp diff --git a/js/src/vm/Time.cpp b/js/src/vm/Time.cpp
index da690fe..3a80d7f 100644 index f59977f0d0e9..5ee4794b3e83 100644
--- a/js/src/vm/Time.cpp --- a/js/src/vm/Time.cpp
+++ b/js/src/vm/Time.cpp +++ b/js/src/vm/Time.cpp
@@ -262,7 +262,7 @@ PRMJ_InvalidParameterHandler(const wchar_t* expression, @@ -247,7 +247,7 @@ static void PRMJ_InvalidParameterHandler(const wchar_t* expression,
/* Format a time value into a buffer. Same semantics as strftime() */ /* Format a time value into a buffer. Same semantics as strftime() */
size_t size_t PRMJ_FormatTime(char* buf, int buflen, const char* fmt,
PRMJ_FormatTime(char* buf, int buflen, const char* fmt, const PRMJTime* prtm, - const PRMJTime* prtm, int equivalentYear,
- int equivalentYear, int offsetInSeconds) + const PRMJTime* prtm, int timeZoneYear,
+ int timeZoneYear, int offsetInSeconds) int offsetInSeconds) {
{
size_t result = 0; size_t result = 0;
#if defined(XP_UNIX) || defined(XP_WIN) #if defined(XP_UNIX) || defined(XP_WIN)
@@ -295,7 +295,8 @@ PRMJ_FormatTime(char* buf, int buflen, const char* fmt, const PRMJTime* prtm, @@ -280,7 +280,8 @@ size_t PRMJ_FormatTime(char* buf, int buflen, const char* fmt,
* Fill out |td| to the time represented by |prtm|, leaving the * Fill out |td| to the time represented by |prtm|, leaving the
* timezone fields zeroed out. localtime_r will then fill in the * timezone fields zeroed out. localtime_r will then fill in the
* timezone fields for that local time according to the system's * timezone fields for that local time according to the system's
@ -62,7 +61,7 @@ index da690fe..3a80d7f 100644
*/ */
struct tm td; struct tm td;
memset(&td, 0, sizeof(td)); memset(&td, 0, sizeof(td));
@@ -305,19 +306,12 @@ PRMJ_FormatTime(char* buf, int buflen, const char* fmt, const PRMJTime* prtm, @@ -290,19 +291,12 @@ size_t PRMJ_FormatTime(char* buf, int buflen, const char* fmt,
td.tm_mday = prtm->tm_mday; td.tm_mday = prtm->tm_mday;
td.tm_mon = prtm->tm_mon; td.tm_mon = prtm->tm_mon;
td.tm_wday = prtm->tm_wday; td.tm_wday = prtm->tm_wday;
@ -84,15 +83,18 @@ index da690fe..3a80d7f 100644
// zone offset |offsetInSeconds| and set the time zone identifier to // zone offset |offsetInSeconds| and set the time zone identifier to
// the empty string. // the empty string.
diff --git a/js/src/vm/Time.h b/js/src/vm/Time.h diff --git a/js/src/vm/Time.h b/js/src/vm/Time.h
index db61e89..597673b 100644 index 3a51d869c922..37b7faeec028 100644
--- a/js/src/vm/Time.h --- a/js/src/vm/Time.h
+++ b/js/src/vm/Time.h +++ b/js/src/vm/Time.h
@@ -55,7 +55,7 @@ PRMJ_NowShutdown() {} @@ -49,7 +49,7 @@ inline void PRMJ_NowShutdown() {}
/* Format a time value into a buffer. Same semantics as strftime() */
extern size_t
PRMJ_FormatTime(char* buf, int buflen, const char* fmt, const PRMJTime* tm,
- int equivalentYear, int offsetInSeconds);
+ int timeZoneYear, int offsetInSeconds);
/* Format a time value into a buffer. Same semantics as strftime() */
extern size_t PRMJ_FormatTime(char* buf, int buflen, const char* fmt,
- const PRMJTime* tm, int equivalentYear,
+ const PRMJTime* tm, int timeZoneYear,
int offsetInSeconds);
/** /**
--
2.21.0