php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #66545
Patch interval.c revision 2014-01-25 21:41 UTC by perrier dot p at gmail dot com
revision 2014-01-25 00:34 UTC by perrier dot p at gmail dot com

Patch interval.c for Date/time related Bug #66545

Patch version 2014-01-25 00:34 UTC

Return to Bug #66545 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: perrier.p@gmail.com

@@ -56,32 +56,27 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
     timelib_apply_localtime(two, 0);
 
 	rt->y = two->y - one->y;
 	rt->m = two->m - one->m;
 	rt->d = two->d - one->d;
-	rt->h = two->h - one->h;
-	rt->i = two->i - one->i;
+	rt->h = two->h - one->h + dst_h_corr;
+	rt->i = two->i - one->i + dst_m_corr;
 	rt->s = two->s - one->s;
-	if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
-		rt->h += dst_h_corr;
-		rt->i += dst_m_corr;
-	}
-
-	rt->days = abs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
+    
+	rt->days = abs(floor((one->sse - two->sse - dst_corr)) / 86400));
 
 	timelib_do_rel_normalize(rt->invert ? one : two, rt);
 
 	/* We need to do this after normalisation otherwise we can't get "24H" */
-	if (one_backup.dst == 1 && two_backup.dst == 0 && two->sse >= one->sse + 86400) {
+	/* Should only be right on the 2 days of the year when DST occurs, false for more or less 362 days so we shouldn't use it
+    if (one_backup.dst == 1 && two_backup.dst == 0 && two->sse >= one->sse + 86400) {
 		if (two->sse < one->sse + 86400 - dst_corr) {
 			rt->d--;
 			rt->h = 24;
-		} else {
-			rt->h += dst_h_corr;
-			rt->i += dst_m_corr;
 		}
 	}
+    */
 
 	/* Restore old TZ info */
 	memcpy(one, &one_backup, sizeof(one_backup));
 	memcpy(two, &two_backup, sizeof(two_backup));
 

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Sep 27 18:01:26 2020 UTC