| diff -aruN nspr-4.8.6/mozilla/nsprpub/pr/include/prtime.h nspr-4.8.6.N/mozilla/nsprpub/pr/include/prtime.h |
| --- nspr-4.8.6/mozilla/nsprpub/pr/include/prtime.h 2009-03-03 08:17:48.000000000 -0800 |
| +++ nspr-4.8.6.N/mozilla/nsprpub/pr/include/prtime.h 2015-04-29 16:32:24.000000000 -0700 |
| @@ -206,7 +206,10 @@ |
| * should treat them as "read-only". |
| */ |
| |
| -NSPR_API(void) PR_NormalizeTime( |
| +NSPR_API(PRTime) PR_NormalizeTime( |
| + PRExplodedTime *exploded, PRTimeParamFn params); |
| + |
| +NSPR_API(void) PR_NormalizeTime_NoDSTAdjust( |
| PRExplodedTime *exploded, PRTimeParamFn params); |
| |
| /**********************************************************************/ |
| diff -aruN nspr-4.8.6/mozilla/nsprpub/pr/src/misc/prtime.c nspr-4.8.6.N/mozilla/nsprpub/pr/src/misc/prtime.c |
| --- nspr-4.8.6/mozilla/nsprpub/pr/src/misc/prtime.c 2015-04-29 16:33:57.000000000 -0700 |
| +++ nspr-4.8.6.N/mozilla/nsprpub/pr/src/misc/prtime.c 2015-04-29 16:33:10.000000000 -0700 |
| @@ -272,7 +272,7 @@ |
| |
| /* Normalize first. Do this on our copy */ |
| copy = *exploded; |
| - PR_NormalizeTime(©, PR_GMTParameters); |
| + PR_NormalizeTime_NoDSTAdjust(©, PR_GMTParameters); |
| |
| numDays = DAYS_BETWEEN_YEARS(1970, copy.tm_year); |
| |
| @@ -387,9 +387,29 @@ |
| } |
| } |
| |
| -PR_IMPLEMENT(void) |
| +NSPR_API(PRTime) |
| PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params) |
| { |
| + PRTime resolvedtime; |
| + PR_NormalizeTime_NoDSTAdjust(time, PR_LocalTimeParameters); |
| + |
| + // Resolve DST shifts explicitly. Note that this will also update *time |
| + // with the corrected time. |
| + resolvedtime = PR_ImplodeTime(time); |
| + PR_ExplodeTime(resolvedtime, params, time); |
| + |
| + // Return the DST-resolved PRTime. |
| + return resolvedtime; |
| +} |
| + |
| +// This function normalizes time, but does not always resolve Daylight Savings |
| +// Time correctly (see SAPPHIRE-10133 for an example). It is the original |
| +// built-in PR_NormalizeTime function in NSPR, but should not be used outside |
| +// of the functions in this file - users should continue to utilize the newer |
| +// PR_NormalizeTime function below (see SAPPHIRE-10152). |
| +PR_IMPLEMENT(void) |
| +PR_NormalizeTime_NoDSTAdjust(PRExplodedTime *time, PRTimeParamFn params) |
| +{ |
| int daysInMonth; |
| PRInt32 numDays; |
| |
| @@ -1723,7 +1743,7 @@ |
| * Mainly to compute wday and yday, but normalized time is also required |
| * by the check below that works around a Visual C++ 2005 mktime problem. |
| */ |
| - PR_NormalizeTime(result, PR_GMTParameters); |
| + PR_NormalizeTime_NoDSTAdjust(result, PR_GMTParameters); |
| /* The remaining work is to set the gmt and dst offsets in tm_params. */ |
| |
| if (zone == TT_UNKNOWN && default_to_gmt) |