commit caffe25b23fbb933463bfc203c008be5a04ad592
parent b934d6b39700160721198ca5c82a86ec472cf16b
Author: William Casarin <jb55@jb55.com>
Date: Sat, 13 Oct 2018 13:40:45 -0700
fix zz
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/viscal.c b/viscal.c
@@ -860,6 +860,7 @@ static int number_of_hours_in_view(struct cal *cal)
static void center_view(struct cal *cal)
{
+ static char buf[128];
time_t current_hour;
struct tm current_tm;
@@ -867,11 +868,12 @@ static void center_view(struct cal *cal)
current_tm.tm_min = 0;
current_hour = mktime(¤t_tm);
- // get time at position top of view and bottom of view / 2
+ int hours = number_of_hours_in_view(cal);
+ cal->start_at = current_hour - cal->today - hours * 60 * 60;
- int half_hours = number_of_hours_in_view(cal) / 2 - 1;
+ format_locale_timet(buf, 128, cal->start_at);
+ printf("DEBUG centering at %s\n", buf);
- cal->start_at = current_hour - cal->today - half_hours * 60 * 60;
cal->scroll = 0;
}