Re: [O] Multiple notions for what's a day

2013-01-17 Thread Sebastien Vauban
Hello Bastien,

Bastien wrote:
 Bastien b...@altern.org writes:

 Indeed, there is a problem here.

 Please try the attached patch against master

 I've now applied the patch in master.

 Let me know if you see anything weird.

I'm just slowly coming back to life ;-), and reading this ML again.

I'll test the above soon, and report any trouble. Thanks!

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Multiple notions for what's a day

2013-01-07 Thread Bastien


Hi Sébastien,

Bastien b...@altern.org writes:

 Indeed, there is a problem here.

 Please try the attached patch against master

I've now applied the patch in master.

Let me know if you see anything weird.

Thanks,

-- 
 Bastien




Re: [O] Multiple notions for what's a day

2013-01-05 Thread Bastien
Hi Sébastien,

Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 For 6 weeks now, since the commit a00a7b2 of Toby, things have changed when
 generating clock tables. For example, instead of getting this (for some sample
 files I have):

Indeed, there is a problem here.

Please try the attached patch against master, together with

  (setq org-time-clocksum-use-effort-durations t)

(or :effort-durations t as a parameter in the clocktable.)

Thanks,

From 9c31d781e9e770a584a9fc04737d3fd352f6a40b Mon Sep 17 00:00:00 2001
From: Bastien Guerry b...@altern.org
Date: Sat, 5 Jan 2013 18:21:55 +0100
Subject: [PATCH] New option `org-time-clocksum-use-effort-durations'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* org.el (org-time-clocksum-format): Add a version tag and add
to the 'org-clock group.
(org-time-clocksum-use-fractional): Ditto.
(org-time-clocksum-use-effort-durations): New option to allow
using `org-effort-durations' when computing clocksum durations.
(org-minutes-to-clocksum-string): Use the new option.

* org-clock.el (org-clocktable-write-default): Let-bind
`org-time-clocksum-use-effort-durations' to a new clocktable
parameter :effort-durations.

Thanks to Sébastien Vauban for pointing the inconsistency.
---
 lisp/org-clock.el |  2 ++
 lisp/org.el   | 90 ---
 2 files changed, 61 insertions(+), 31 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 83ff459..5e74332 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2316,6 +2316,8 @@ from the dynamic block definition.
 	 (maxlevel (or (plist-get params :maxlevel) 3))
 	 (emph (plist-get params :emphasize))
 	 (level-p (plist-get params :level))
+	 (org-time-clocksum-use-effort-durations
+	  (plist-get params :effort-durations))
 	 (timestamp (plist-get params :timestamp))
 	 (properties (plist-get params :properties))
 	 (ntcol (max 1 (or (plist-get params :tcolumns) 100)))
diff --git a/lisp/org.el b/lisp/org.el
index 78429a7..88d13a0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2774,6 +2774,8 @@ means durations longer than a day will be expressed in days and
 minutes, and durations less than a day will be expressed entirely
 in minutes (even for durations longer than an hour).
   :group 'org-time
+  :group 'org-clock
+  :version 24.3
   :type '(choice (string :tag Format string)
 		 (set :tag Plist
 		  (group :inline t (const :tag Years :years)
@@ -2808,9 +2810,24 @@ in minutes (even for durations longer than an hour).
 			 (const t)
 
 (defcustom org-time-clocksum-use-fractional nil
-  If non-nil, \\[org-clock-display] uses fractional times.
-org-mode generates a time duration.
+  When non-nil, \\[org-clock-display] uses fractional times.
+See `org-time-clocksum-format' for more on time clock formats.
   :group 'org-time
+  :group 'org-clock
+  :version 24.3
+  :type 'boolean)
+
+(defcustom org-time-clocksum-use-effort-durations t
+  When non-nil, \\[org-clock-display] uses effort durations.
+E.g. by default, one day is considered to be a 8 hours effort,
+so a task that has been clocked for 16 hours will be displayed
+as during 2 days in the clock display or in the clocktable.
+
+See `org-effort-durations' on how to set effort durations
+and `org-time-clocksum-format' for more on time clock formats.
+  :group 'org-time
+  :group 'org-clock
+  :version 24.3
   :type 'boolean)
 
 (defcustom org-time-clocksum-fractional-format %.2f
@@ -16873,72 +16890,83 @@ If there is already a time stamp at the cursor position, update it.
   Format number of minutes as a clocksum string.
 The format is determined by `org-time-clocksum-format',
 `org-time-clocksum-use-fractional' and
-`org-time-clocksum-fractional-format'.
-  (let ((clocksum ) fmt n)
+`org-time-clocksum-fractional-format' and
+`org-time-clocksum-use-effort-durations'.
+  (let ((clocksum ) h d w mo y fmt n)
+(setq h (if org-time-clocksum-use-effort-durations
+		(cdr (assoc h org-effort-durations)) 60)
+	  d (if org-time-clocksum-use-effort-durations
+		(/ (cdr (assoc d org-effort-durations)) h) 24)
+	  w (if org-time-clocksum-use-effort-durations
+		(/ (cdr (assoc w org-effort-durations)) (* d h)) 7)
+	  mo (if org-time-clocksum-use-effort-durations
+		 (/ (cdr (assoc m org-effort-durations)) (* d h)) 30)
+	  y (if org-time-clocksum-use-effort-durations
+		(/ (cdr (assoc y org-effort-durations)) (* d h)) 365))
 ;; fractional format
 (if org-time-clocksum-use-fractional
 	(cond
 	 ;; single format string
 	 ((stringp org-time-clocksum-fractional-format)
-	  (format org-time-clocksum-fractional-format (/ m 60.0)))
+	  (format org-time-clocksum-fractional-format (/ m (float h
 	 ;; choice of fractional formats for different time units
 	 ((and (setq fmt (plist-get org-time-clocksum-fractional-format :years))
-	   ( (/ (truncate m) (* 365 24 60)) 0))
-	  (format fmt (/ m (* 365 24 60.0
+	   ( (/ (truncate m) 

[O] Multiple notions for what's a day

2012-12-31 Thread Sebastien Vauban
Hello,

For 6 weeks now, since the commit a00a7b2 of Toby, things have changed when
generating clock tables. For example, instead of getting this (for some sample
files I have):

| File  | Headline   |  Time |
|---++---|
|   | ALL Total time | 30:19 |
|---++---|
| A.org | File time  |  2:59 |
|---++---|
| B.org | File time  |  2:30 |
|---++---|
| C.org | File time  | 24:50 |

(edited for the sake of simplicity)

we do have, as of today:

| File  | Headline   | Time|
|---++-|
|   | ALL Total time | 1d 6:19 |
|---++-|
| A.org | File time  | 2:59|
|---++-|
| B.org | File time  | 2:30|
|---++-|
| C.org | File time  | 1d 0:50 |

That is, the presentation *default* has changed: it now displays big amounts
of hours in days (of 24 hours).

I don't welcome the change of the default as such -- as that could impact
computations made on those figures; OK, that's not such a big deal --, but I
clearly like the ability to generate such formats, much more readable.

However, there is now a problem of interpretation for the value of days;
until now, a day was valued as 8 hours... see `org-effort-durations':

╭
│ Its value is ((h . 60)
│  (d . 480) -- 8 hours a day
│  (w . 2400) -- 40 hours a week
│  (m . 9600)
│  (y . 96000))
╰

In the current situation, you'd express days of 8 hours for the Effort
property, but be presented with days of 24 hours for clocking display. Weird,
no?

I guess that the clock tables should use the values defined in
`org-effort-durations' for their display. Or, at least, any other solution
where a day has the same value when used for clock estimates and for clock
reports...

Just wanted to show a problem, and start a discussion on what should be
done...

Best regards,
  Seb

-- 
Sebastien Vauban