diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-23 17:22:19 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-23 17:24:27 +0200 |
commit | e3556cfa008a7a2df2ada035ee25a3035e961558 (patch) | |
tree | 73a4f792031c9797acd75b2557ea0397b57c31bf /module/vcalendar | |
parent | Add time-{min,max}. (diff) | |
download | calp-e3556cfa008a7a2df2ada035ee25a3035e961558.tar.gz calp-e3556cfa008a7a2df2ada035ee25a3035e961558.tar.xz |
Add event-length/day.
Diffstat (limited to '')
-rw-r--r-- | module/vcalendar/datetime.scm | 7 |
1 files changed, 7 insertions, 0 deletions
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)))) |