commit bfab4caec375ac7f0932cf8fa0b1c75e38c9e589
parent e4b438aa46c5048965d2cbbfabdcb4f630ff2828
Author: William Casarin <jb55@jb55.com>
Date: Fri, 24 Aug 2018 15:59:25 -0700
default start_at to be roughly around center
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/viscal.c b/viscal.c
@@ -114,13 +114,14 @@ static const double dashed[] = {1.0};
static void
calendar_create(struct cal *cal) {
time_t now;
- time_t today;
+ time_t today, nowh;
struct tm nowtm;
now = time(NULL);
nowtm = *localtime(&now);
- nowtm.tm_hour = 0;
nowtm.tm_min = 0;
+ nowh = mktime(&nowtm);
+ nowtm.tm_hour = 0;
today = mktime(&nowtm);
cal->chord = 0;
@@ -128,7 +129,7 @@ calendar_create(struct cal *cal) {
cal->minute_round = 30;
cal->ncalendars = 0;
cal->nevents = 0;
- cal->start_at = 5*60*60;
+ cal->start_at = nowh - today - 4*60*60;
cal->scroll = 0;
cal->repeat = 1;
cal->today = today;