Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
"name": "Libzmanim",
"version": "1.0-1",
"description": "a C library for zmanim and hebrew dates",
"repository": {
"type": "git",
"url": "git://github.com/yparitcher/libzmanim"
},
"build": {
"unflags":"-std=gnu11",
"flags":[
"-I include"
,"-I windows"
,"-D _WIN32"
Comment on lines +14 to +15
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no need to define windows.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is one of the hardest things i had here, i wouldn't call it defining windows as more like for platorms who don't have stpncpy , if i won't include the stpncpy.h and the source the file the avr-gcc will fail cause it won't find them, i don't know of any other way to handle this.

,"-Wall"
,"-Wextra"
,"-Wno-format-truncation"
,"-O2"
,"-pedantic"

,"-std=c11"
],
"includeDir": ".",
"srcDir": ".",
"srcFilter": "+<windows> +<src>"
},
"authors": [
{
"name": "Yparitcher",
"email": "[email protected]",
"url": "https://paritcher.com/"
}
],
"license": "MIT",
"frameworks": "*",
"platforms": "*"
}
12 changes: 6 additions & 6 deletions src/hdateformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ or connect to: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
#include "stpncpy.h"
#endif

const char* hchar[]={ "׆", "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק", "ר", "ש", "ת", "״", "׳"};
const char* hmonth[]={ "אדר א׳", "ניסן", "אייר", "סיון", "תמוז", "אב", "אלול", "תשרי", "חשון", "כסלו", "טבת", "שבט", "אדר", "אדר ב׳"};
const char* hchar[]={ "׆", "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק", "ר", "ש", "ת", "\"", "'"};
const char* hmonth[]={ "אדר א'", "ניסן", "אייר", "סיון", "תמוז", "אב", "אלול", "תשרי", "חשון", "כסלו", "טבת", "שבט", "אדר", "אדר ב'"};
Comment on lines -23 to +24
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the geresh & gershaim better,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to have arduino specific files in the repo. The library is designed with a 32 bit int (most modern platforms). to adapt it to a 16 bit int would need to change many of the signatures to guarantee correctness, not just the few you changed

so far it has worked splendidly with what i have right now.
currently arduino doesn't have memory to use the zmanim.c, so i plan to port it to esp32 which i believe is a 32bit library.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the geresh & gershaim better,

unfortuently those don't display well, in LCD, the alternative the way i see it is to have a completely different set of strings just for embedded, but then you'd have to maintain 2 sets.

const char* hwday[]={ "שביעי", "ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"};
const char* parshahchar[]={"\0", "בראשית", "נח", "לך לך", "וירא", "חיי שרה", "תולדות", "ויצא", "וישלח", "וישב", "מקץ", "ויגש", "ויחי", "שמות", "וארא", "בא", "בשלח", "יתרו", "משפטים", "תרומה", "תצוה", "כי תשא", "ויקהל", "פקודי", "ויקרא", "צו", "שמיני", "תזריע", "מצורע", "אחרי מות", "קדושים", "אמור", "בהר", "בחוקותי", "במדבר", "נשא", "בהעלותך", "שלח", "קרח", "חקת", "בלק", "פינחס", "מטות", "מסעי", "דברים", "ואתחנן", "עקב", "ראה", "שופטים", "כי תצא", "כי תבוא", "נצבים", "וילך", "האזינו", "וזאת הברכה", "ויקהל - פקודי", "תזריע - מצורע", "אחרי מות - קדושים", "בהר - בחוקותי", "חקת - בלק", "מטות - מסעי", "נצבים - וילך"};

Expand Down Expand Up @@ -254,9 +254,9 @@ const char* yomtovformat(yomtov current)
case PESACH_SHEINI:
return "פסח שני";
case LAG_BAOMER:
return "ל״ג בעומר";
return "ל\"ג בעומר";
case TU_BAV:
return "ט״ו באב";
return "ט\"ו באב";
case CHANUKAH_DAY1:
case CHANUKAH_DAY2:
case CHANUKAH_DAY3:
Expand All @@ -267,7 +267,7 @@ const char* yomtovformat(yomtov current)
case CHANUKAH_DAY8:
return "חנוכה";
case TU_BISHVAT:
return "ט״ו בשבט";
return "ט\"ו בשבט";
case PURIM_KATAN:
return "פורים קטן";
case SHUSHAN_PURIM_KATAN:
Expand All @@ -279,7 +279,7 @@ const char* yomtovformat(yomtov current)
case SHIVA_ASAR_BTAAMUZ:
return "שבעה עשר בתמוז";
case TISHA_BAV:
return "ט׳ באב";
return "תשעה באב";
case TZOM_GEDALIA:
return "צום גדליה";
case ASARAH_BTEVES:
Expand Down
8 changes: 5 additions & 3 deletions src/hebrewcalendar.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,18 @@ const parshah parshahlist[17][56] = {
{NOPARSHAH, VAYELECH, HAAZINU, NOPARSHAH, BERESHIT, NOACH, LECH_LECHA, VAYEIRA, CHAYEI_SARAH, TOLEDOT, VAYETZE, VAYISHLACH, VAYESHEV, MIKETZ, VAYIGASH, VAYECHI, SHEMOT, VAEIRA, BO, BESHALACH, YITRO, MISHPATIM, TERUMAH, TETZAVEH, KI_TISA, VAYAKHEL, PEKUDEI, VAYIKRA, TZAV, SHEMINI, TAZRIA, METZORA, NOPARSHAH, ACHAREI_MOT, KEDOSHIM, EMOR, BEHAR, BECHUKOTAI, BAMIDBAR, NASO, BEHAALOTECHA, SHLACH, KORACH, CHUKAT, BALAK, PINCHAS, MATOT, MASEI, DEVARIM, VAETCHANAN, EIKEV, REEH, SHOFTIM, KI_TEITZEI, KI_TAVO, NITZAVIM},
{NOPARSHAH, NOPARSHAH, HAAZINU, NOPARSHAH, NOPARSHAH, BERESHIT, NOACH, LECH_LECHA, VAYEIRA, CHAYEI_SARAH, TOLEDOT, VAYETZE, VAYISHLACH, VAYESHEV, MIKETZ, VAYIGASH, VAYECHI, SHEMOT, VAEIRA, BO, BESHALACH, YITRO, MISHPATIM, TERUMAH, TETZAVEH, KI_TISA, VAYAKHEL, PEKUDEI, VAYIKRA, TZAV, SHEMINI, TAZRIA, METZORA, NOPARSHAH, ACHAREI_MOT, KEDOSHIM, EMOR, BEHAR, BECHUKOTAI, BAMIDBAR, NASO, BEHAALOTECHA, SHLACH, KORACH, CHUKAT, BALAK, PINCHAS, MATOT_MASEI, DEVARIM, VAETCHANAN, EIKEV, REEH, SHOFTIM, KI_TEITZEI, KI_TAVO, NITZAVIM_VAYELECH}};

int HebrewLeapYear(int year)
int HebrewLeapYear(int hyear)
{
long int year=hyear;//8 bit
if ((((7 * year) + 1) % 19) < 7)
return 1;
else
return 0;
}

long int HebrewCalendarElapsedDays(int year)
long int HebrewCalendarElapsedDays(int hyear)
{
long int year=hyear;// 8 bit
long int MonthsElapsed =
(235 * ((year - 1) / 19)) // Months in complete cycles so far.
+ (12 * ((year - 1) % 19)) // Regular months in this cycle.
Expand Down Expand Up @@ -933,7 +935,7 @@ int iscandlelighting(hdate date)
|| current == SHAVOUS_DAY2
|| current == ROSH_HASHANAH_DAY2
|| current == SIMCHAS_TORAH)
&& date.wday == 6) {return 2;}
) {return 2;}
if((date.month == 9 && date.day == 24)
|| (current >= CHANUKAH_DAY1 && current <= CHANUKAH_DAY7))
{
Expand Down
2 changes: 1 addition & 1 deletion src/zmanim.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ hdate gettzais72(hdate date, location here)
return calctimeoffset(getsunset(date, here), MINUTES72);
}

hdate calcmoladoffset(hdate date, int offsetsec)
hdate calcmoladoffset(hdate date, long int offsetsec)
{
molad result = getmolad(date.year, date.month);
int tz = (-result.offset) + date.offset;
Expand Down