[Timeline] Truncate start and end times
This commit is contained in:
parent
7864384e73
commit
003051ab24
|
@ -214,11 +214,9 @@ where MARKER is a marker to the beginning of the corresponding
|
||||||
heading and CLOCK-TIMES is a list of cons cells of the
|
heading and CLOCK-TIMES is a list of cons cells of the
|
||||||
form (START . END), where START and END are the starting and
|
form (START . END), where START and END are the starting and
|
||||||
ending times of a clock line for this task. START and END are
|
ending times of a clock line for this task. START and END are
|
||||||
given as seconds since the epoch, as a floating point number. No
|
given as seconds since the epoch, as a floating point number.
|
||||||
truncation with respect to TSTART and TEND is done, i.e., START
|
Truncation with respect to TSTART and TEND is done, i.e., START
|
||||||
or END may occassionally lie outside of these limits, as long as
|
or END will always be in the interval [TSTART,TEND]."
|
||||||
the corresponding clockline has non-empty intersection with the
|
|
||||||
given bounds."
|
|
||||||
;; adapted from `org-clock-sum’
|
;; adapted from `org-clock-sum’
|
||||||
(when (eq major-mode 'org-mode)
|
(when (eq major-mode 'org-mode)
|
||||||
(let* ((tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart))
|
(let* ((tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart))
|
||||||
|
@ -236,7 +234,9 @@ given bounds."
|
||||||
(when (or (<= tstart te tend)
|
(when (or (<= tstart te tend)
|
||||||
(<= tstart ts tend)
|
(<= tstart ts tend)
|
||||||
(<= ts tstart tend te))
|
(<= ts tstart tend te))
|
||||||
(push (cons ts te) times))))
|
(push (cons (max ts tstart)
|
||||||
|
(min te tend))
|
||||||
|
times))))
|
||||||
;; when on headlines, store away collected clocklines
|
;; when on headlines, store away collected clocklines
|
||||||
#'(lambda ()
|
#'(lambda ()
|
||||||
;; add currently running clock if wanted
|
;; add currently running clock if wanted
|
||||||
|
@ -250,7 +250,9 @@ given bounds."
|
||||||
(<= current-clock-start
|
(<= current-clock-start
|
||||||
tstart tend
|
tstart tend
|
||||||
current-clock-end))
|
current-clock-end))
|
||||||
(push (cons current-clock-start current-clock-end) times))))
|
(push (cons (max current-clock-start tstart)
|
||||||
|
(min current-clock-end tend))
|
||||||
|
times))))
|
||||||
;; store away clocklines of current headline
|
;; store away clocklines of current headline
|
||||||
(when (not (null times))
|
(when (not (null times))
|
||||||
(push (cons (point-marker) times) task-clock-times)
|
(push (cons (point-marker) times) task-clock-times)
|
||||||
|
|
Loading…
Reference in New Issue