From e3556cfa008a7a2df2ada035ee25a3035e961558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 23 Apr 2019 17:22:19 +0200 Subject: Add event-length/day. --- module/vcalendar/datetime.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'module') diff --git a/module/vcalendar/datetime.scm b/module/vcalendar/datetime.scm index 2715b5db..1e5b5853 100644 --- a/module/vcalendar/datetime.scm +++ b/module/vcalendar/datetime.scm @@ -49,3 +49,10 @@ Event must have the DTSTART and DTEND attribute set." (time-difference (attr e 'DTEND) (attr e 'DTSTART))) + +;; Returns the length of the part of @var{e} which is within the day +;; starting at the time @var{start-of-day}. +(define-public (event-length/day e start-of-day) + (time-difference + (time-min (add-day start-of-day) (attr e 'DTEND)) + (time-max start-of-day (attr e 'DTSTART)))) -- cgit v1.2.3