commit 6b7dca72899e5f732ff057cde1659d43ee5dc0c9
parent 5b34ff8fe9ed2ad915e4587d6974cd2be455e8a8
Author: Wim Dupont <wim@wimdupont.com>
Date: Sun, 16 Mar 2025 18:43:36 +0100
use utc instead of localtime
Diffstat:
M | scal.c | | | 34 | +++++++++++++++++----------------- |
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/scal.c b/scal.c
@@ -175,7 +175,7 @@ print_month(const int monthadd, int *y)
(*y)+=2;
otm.tm_mon += monthadd;
otm.tm_mday = 1;
- mktime(&otm);
+ timegm(&otm);
wcount = get_days(&otm);
wattron(wwin, COLOR_PAIR(MONTH_TITLE_COLOR));
@@ -373,7 +373,7 @@ add_note(struct tm *tm) {
notes[note_count] = get_note(answer, len);
notes[note_count]->time.tm_mday+=(i-1);
- mktime(¬es[note_count]->time);
+ timegm(¬es[note_count]->time);
note_count++;
}
write_notes();
@@ -746,8 +746,8 @@ get_days(const struct tm *tm)
int
days_between(struct tm *tsa, struct tm *tsb)
{
- time_t a = mktime(tsa);
- time_t b = mktime(tsb);
+ time_t a = timegm(tsa);
+ time_t b = timegm(tsb);
return (b - a)/(60*60*24);
}
@@ -758,8 +758,8 @@ same_day(struct tm *a, struct tm *b, Recurring recurring)
if (a == NULL || b == NULL)
return 0;
- mktime(a);
- mktime(b);
+ timegm(a);
+ timegm(b);
switch (recurring) {
case WEEKLY:
@@ -806,7 +806,7 @@ move_page_up(void)
highlight = 0;
highltm.tm_mday = highlight+1;
highltm.tm_mon -= 1;
- mktime(&highltm);
+ timegm(&highltm);
}
void
@@ -815,7 +815,7 @@ move_page_down(void)
highlight = 0;
highltm.tm_mday = highlight+1;
highltm.tm_mon += 1;
- mktime(&highltm);
+ timegm(&highltm);
}
void
@@ -824,10 +824,10 @@ move_up(void)
if (highlight > 0) {
highlight = MAX(highlight-DAY_COLUMN_SIZE, 0);
highltm.tm_mday = highlight+1;
- mktime(&highltm);
+ timegm(&highltm);
} else if (highlight == 0){
highltm.tm_mday -= 1;
- mktime(&highltm);
+ timegm(&highltm);
highlight = highltm.tm_mday -1;
}
}
@@ -840,16 +840,16 @@ move_down(void)
if (highlight < wcount-DAY_COLUMN_SIZE) {
highlight = MIN(highlight+DAY_COLUMN_SIZE, wcount-1);
highltm.tm_mday = highlight+1;
- mktime(&highltm);
+ timegm(&highltm);
} else if (highlight < wcount-1) {
highlight = wcount-1;
highltm.tm_mday = highlight+1;
- mktime(&highltm);
+ timegm(&highltm);
} else if (highlight == wcount-1){
highlight = 0;
highltm.tm_mday = highlight+1;
highltm.tm_mon += 1;
- mktime(&highltm);
+ timegm(&highltm);
}
}
@@ -861,12 +861,12 @@ move_right(void)
if (highlight < wcount-1) {
highlight++;
highltm.tm_mday = highlight+1;
- mktime(&highltm);
+ timegm(&highltm);
} else if (highlight == wcount-1){
highlight = 0;
highltm.tm_mday = highlight+1;
highltm.tm_mon += 1;
- mktime(&highltm);
+ timegm(&highltm);
}
}
@@ -876,10 +876,10 @@ move_left(void)
if (highlight > 0) {
highlight--;
highltm.tm_mday = highlight+1;
- mktime(&highltm);
+ timegm(&highltm);
} else if (highlight == 0){
highltm.tm_mday -= 1;
- mktime(&highltm);
+ timegm(&highltm);
highlight = highltm.tm_mday -1;
}
}