Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit d0c3f7b

Browse files
committed
Fix #36
1 parent 066f86e commit d0c3f7b

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

core/InputParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

core/Time.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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
?>

core/Utilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
class Utilities {
66

7-
const VERSION = 'v1.0.15';
7+
const VERSION = 'v1.0.16';
88

99
const DEFAULT_LINE_LENGTH = 125;
1010

0 commit comments

Comments
 (0)