From 7758acb84655bbc8d1c1fe1066b4d0c7873fbd96 Mon Sep 17 00:00:00 2001 From: Elyahu Date: Tue, 26 Dec 2023 00:39:59 -0700 Subject: [PATCH] support milliseconds --- .DS_Store | Bin 0 -> 6148 bytes Sources/.DS_Store | Bin 0 -> 6148 bytes Sources/KosherSwift/AstronomicalCalendar.swift | 14 ++++++++++---- Sources/KosherSwift/ComplexZmanimCalendar.swift | 4 ++-- Tests/.DS_Store | Bin 0 -> 6148 bytes Tests/KosherSwiftTests/KosherSwiftTests.swift | 1 - 6 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .DS_Store create mode 100644 Sources/.DS_Store create mode 100644 Tests/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e69d6846b228c8e4b3ef1563fc9446286a5e1e67 GIT binary patch literal 6148 zcmeHKO>fgc5S>j^;!st}fl9p~S>jrS&_X4|#Z8k##fMN`!2wXPf~cfCX;y3^<$QHzKiIAi@LieDIyv#(gq z^e|7TXN+hB4zyCQpEV8l5`fE5&;w>j9_fGzYES*=+x?v*#W>=*;)r*~5L*?;jk_=S^ql&fQ0+gUjS9m7kCSOkf{Y zwr%hlSdWSZAN)z0$n+c|%-W3xj4G-i^|dwgUvak9Hba}3 zRlq9nw+it7;KCU_gQZ5bb)ZmJ0AL;6%24MI1Ln8}J%go2jKGAZ0yR~bD~8Z?^t&d` zGgxZWbQ0$BADYo&mw z_xxTLDVei%B{@E8UHDr#8^@Iz6$OPkj#Y(^;$65hjJaF^dIn34=z-Y}0VRVitOEa3 FfuA8x+JOK7 literal 0 HcmV?d00001 diff --git a/Sources/.DS_Store b/Sources/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c5256bdebc36c1caf251b594f51a5481789fc7a0 GIT binary patch literal 6148 zcmeHKO;5r=5S;~-5@NzZ6OK*15=BrFG%&0;ZxHxVT&=!~ zOg6W&nz!;+(YkT_GI8ThJc^o~;T0X7OBs06xZ_>;y`)`QKayeG@x$Iw5&UisORg{d zuq%_M9EIITaa}!O6|6$LR349OjcUcN?^P!id%R!6c(>k|ObXV<=Jvr^`!RS5<%_z1 z5cth1TQfL?R}AK8^6U=7K!y)kF=bC#jI01FzzQsn0%irXipz7$e5b4cE3hC1XnnBJ z2_1u}MzwU{pjrUL9Hy0FOh1dnu?;!~Q;j%-CNvdMQ-x_Ugr;NOHg%4{RHLSYFwKWB zR~Dv25$fuAep{7;a5VDB3a|n{6`Qaqg6b#f>jJ32Cm(i7B-lhQ2F_>z^3>yCkC>eNQ1s1BnCoSPzdjJ3c literal 0 HcmV?d00001 diff --git a/Sources/KosherSwift/AstronomicalCalendar.swift b/Sources/KosherSwift/AstronomicalCalendar.swift index aca61dc..b75081c 100644 --- a/Sources/KosherSwift/AstronomicalCalendar.swift +++ b/Sources/KosherSwift/AstronomicalCalendar.swift @@ -553,13 +553,19 @@ public class AstronomicalCalendar { let hours = Int(calculatedTime) calculatedTime -= Double(hours) - let minutes = Int(calculatedTime * 60) - calculatedTime -= Double(minutes) / 60 - let seconds = Int(calculatedTime * 3600) - + + calculatedTime = calculatedTime * 60 + let minutes = Int(calculatedTime) + calculatedTime -= Double(minutes) + + calculatedTime = calculatedTime * 60 + let seconds = Int(calculatedTime) + calculatedTime -= Double(seconds) + components.hour = hours components.minute = minutes components.second = seconds + components.nanosecond = Int(calculatedTime * 1000 * 1000000) var returnDate = gregorianCalendar.date(from: components) diff --git a/Sources/KosherSwift/ComplexZmanimCalendar.swift b/Sources/KosherSwift/ComplexZmanimCalendar.swift index fceb740..08253ac 100644 --- a/Sources/KosherSwift/ComplexZmanimCalendar.swift +++ b/Sources/KosherSwift/ComplexZmanimCalendar.swift @@ -3048,8 +3048,8 @@ public class ComplexZmanimCalendar : ZmanimCalendar { } /** - * Method to return tzais (dusk) calculated as 13.5 minutes zmaniyos. - * + * Method to return tzais (dusk) calculated as 13.5 minutes zmaniyos after sunset. + * - Warning: This zman is EXTREMELY early! It is so early that it was removed from KosherJava since it caused a situation the developer, Eliyahu Hershfeld, was uncomfortable with. The situation was in Canada where a user using his phone saw that this time was listed as the time for nightfall, and he figured that he could end shabbos then. Whie there are no poskim that write to do that! The earliest time that I have found to end shabbos is 20 regular minutes after sunset and that is only in Israel and the surrounding areas. Every where else was recommended 30 minutes at the bare minimum. Therefore, someone who wants to use/include this time has an obligation to make sure that it does not get used for shabbos by dimming it or showing another time. * @return the Date representing the time. If the calculation can't be computed such as in the Arctic * Circle where there is at least one day a year where the sun does not rise, and one where it does not set, * a nil will be returned. See detailed explanation on top of the ``AstronomicalCalendar`` diff --git a/Tests/.DS_Store b/Tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8071fa9385aca70bb1bb9030de0c74c6ebb549e8 GIT binary patch literal 6148 zcmeHKO-sW-5S^`6Q;Lv-LXQEjqV*HRON@FDZ>H!$r8c(OV9ZLAnnNk%tbfQ~;@{EP z*{vv5dXpeCF#9I6^OEdK+3f&;@CMy=02=@-bcK}~4nLThS3Y4ClbJyjbdMe+;6n}} z+)h+;qKpctZ)d{^NJya%U%y`lExb-4gY-C(H$fx=ss-3bTzw~_B~9fAdHQJhufby! zrdhN3CMq-4*|~XZ-l|(yeqZK(*2xB`*GVqaRZGe!7{{I9EbQfNd+|WVStpEp2@%3> z4@)l3!?-JRPY&X4N?c!0ST(EGwj0CY#!hp^+1zf9R-EDP2F6>PJEKv}T3TM)J8j=b z53zivm4LwCG1-E_F}z?fb)8Rs5=Sz=!`ktE#(YLrfE8c`%A|nVqpW(FUW(s^6<`HQ zp@7;S9CU@Q!9pW#9XL=6fLO&e8OExYP#njgYp~FWGiX9n5j9nq7DH${<{eY#8Z0zw zItbHz2=ioNIut=q$NM`}4#L&QBP+lPd{;pAerUEj|Brs}|EY)vR)7`wp9+ZTp?~P% z+RWKHu}XE;I_THv%2ZvU@sol99mQCyj^YM78Ri`oAi4$%jhI2>KLR8J53InSD)0dc C&|<>? literal 0 HcmV?d00001 diff --git a/Tests/KosherSwiftTests/KosherSwiftTests.swift b/Tests/KosherSwiftTests/KosherSwiftTests.swift index 4e57e60..e628851 100644 --- a/Tests/KosherSwiftTests/KosherSwiftTests.swift +++ b/Tests/KosherSwiftTests/KosherSwiftTests.swift @@ -399,7 +399,6 @@ class KosherSwiftTests: XCTestCase { let calculator = ComplexZmanimCalendar(location: geoLocation) let format = DateFormatter() format.timeStyle = .full - calculator.astronomicalCalculator = SunTimesCalculator() print(format.string(from: calculator.getSeaLevelSunrise()!)) print(format.string(from: calculator.getSeaLevelSunset()!)) }