This repository was archived by the owner on Mar 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ public static function getEndTimestamp(string $t) : int {
4747 }
4848 }
4949
50- $ timestamp = strtotime ($ plusOneDay ? "tomorrow " : "today " ) + 3600 * $ hs + 60 * $ mins ;
50+ $ timestamp = strtotime ($ plusOneDay ? "tomorrow " : "today " )
51+ + 3600 * ($ hs + Time::getTimeChangeDifference ())
52+ + 60 * $ mins ;
5153 }
5254 else if ( isset ($ matches [2 ]) ){ // Gruppe 2, d.h. Minuten- und/oder Stundenangabe
5355 $ hs = 0 ;
Original file line number Diff line number Diff line change @@ -85,5 +85,29 @@ public static function secToTime(int $t) : string {
8585 }
8686 return self ::$ time ->getDurationString ($ t );
8787 }
88+
89+ public static function isSummertime (int $ now = null ) : bool {
90+ return date ('I ' , is_null ($ now ) ? time () : $ now ) === '1 ' ;
91+ }
92+
93+ public static function getTimeChangeDifference (int $ now = null ) : int {
94+ $ now = is_null ($ now ) ? time () : $ now ;
95+ $ todayNight = self ::isSummertime (strtotime ("today 00:00 " , $ now ));
96+ $ todayMid = self ::isSummertime (strtotime ("today 12:00 " , $ now ));
97+ if ( $ todayMid === $ todayNight || intval (date ('G ' , $ now )) < 3 ){
98+ return 0 ;
99+ }
100+ else {
101+ if ( !$ todayNight && $ todayMid ){
102+ return -1 ;
103+ }
104+ if ( $ todayNight && !$ todayMid ){
105+ return +1 ;
106+ }
107+ else {
108+ return 0 ;
109+ }
110+ }
111+ }
88112}
89113?>
Original file line number Diff line number Diff line change 44 */
55class Utilities {
66
7- const VERSION = 'v1.0.15 ' ;
7+ const VERSION = 'v1.0.16 ' ;
88
99 const DEFAULT_LINE_LENGTH = 125 ;
1010
You can’t perform that action at this time.
0 commit comments