to use this document yourself.
• # Time Budgeting

#### Functional Spec v0.25

Gingko tree version

Core idea is this:

• Budget the next X hours into key activities (proj 1, proj 2, family, sleep).
• Each activity has a meter, that starts at -{{budgetted amt}}.
• Every second that passes where an activity is not being done, that activity’s meter decays at a rate determined by the budget.
• A timer is always running. Either “activity X” or “Untracked”.

Use the principles of YNAB to budget time. Keep in mind the differences between time (need to match certain amount per week) vs. money (need to be under certain amount per week). Deficits and Surpluses need to carry over.

• ### Notes

Sticking with “weekly” might make it tricky, and restricts the way the app can be used. How about “Budget the next X hours”

• ## Use case

I have five important activities to do, and have trouble balancing them. It would be easier if I had a “time budget”.

• Gingko
• Stark
• PhD
• Zeno
• Sleep

If I could set a target number of hours to each per week, and track my surplus & deficit, I’ll stay balanced and certain things I’ve been leaving behind (e.g. PhD) will get done.

• ## UI

Each activity requires 3 elements:

• Activity name
• Surplus or deficit meter
• Way to Play/Pause

Optionally, can include:

• Numerical surplus/deficit indicator

Also need a way to:

• Set weekly budget
• Start weekly clock
• Reset weekly clock
• ## Code

The core idea is that each meter measures the difference between how much time we’ve spent on an activity, and how much we should have spent so far according to the budgets.

[;\Delta_i = \frac{t_i}{t} - \frac{b_i}{T};]

where [;t;] is global time elapsed, [;t_i;] is the elapsed time for activity i, [;b_i;] is the time budgeted to i, and [;T;] is the total time we’re covering.
(use TeX the World chrome extension for Latex)

Problem with this approach is that it requires resetting, and doesn’t allow for carrying over of the surplus/deficit (which is the whole point).

• ### Mockups

• ##### (from SO: Bar chart with negative values)
• Require that the delta change shouldn’t be too fast at first, too slow at end (as happens with linear mapping).

Mapping should be like this:

• ### Global variables

• t : total time elapsed
ti[] : array of time elapsed per activity i
bi[] : array of budget amounts per activity i
T : total time to budget
dt : time step
• ### Functions

• tick() {
t     = t + dt;
ti[0] = ti[0] + dt;
//etc
}
• updateMeters() {
setMeter(id, deltaToPercent(id));
}
• setMeter(id, percent) {
//select relevant progress bars, set values
}
• deltaToPercent(id) {
var x = ti[id];
var b = bi[id];
if( x > 0 ) {
return 100*x/(1-b/T);
} else {
return 100*x*T/b;
}
}
{"cards":[{"_id":"2cab16788bab5e084a000008","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":1,"parentId":null,"content":"# Time Budgeting\n#### Functional Spec v0.25\n[Gingko tree version](https://beta.gingkoapp.com/app-timebudget)\n\nCore idea is this:\n\n* Budget the next X hours into key activities (proj 1, proj 2, family, sleep).\n* Each activity has a meter, that starts at -{{budgetted amt}}.\n* Every second that passes where an activity is not being done, that activity's meter decays at a rate determined by the budget.\n* A timer is always running. Either \"activity X\" or \"Untracked\".\n\n\nUse the principles of [YNAB](http://youneedabudget.com) to budget time. Keep in mind the differences between time (need to match certain amount per week) vs. money (need to be under certain amount per week). Deficits and Surpluses need to carry over."},{"_id":"2cab46308bab5e084a00000b","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":0.5,"parentId":"2cab16788bab5e084a000008","content":"## Use case\nI have five important activities to do, and have trouble balancing them. It would be easier if I had a \"time budget\".\n\n* Gingko\n* Stark\n* PhD\n* Zeno\n* Sleep\n\nIf I could set a target number of hours to each per week, and track my surplus & deficit, I'll stay balanced and certain things I've been leaving behind (e.g. PhD) will get done."},{"_id":"2cab19988bab5e084a000009","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":1,"parentId":"2cab16788bab5e084a000008","content":"## UI\nEach activity requires 3 elements:\n\n* Activity name\n* Surplus or deficit meter\n* Way to Play/Pause\n\nOptionally, can include:\n\n* Numerical surplus/deficit indicator\n\nAlso need a way to:\n\n* Set weekly budget\n* Start weekly clock\n* Reset weekly clock"},{"_id":"2cab5cfb8bab5e084a00000f","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":1,"parentId":"2cab19988bab5e084a000009","content":"### Mockups\n![](http://i.imgur.com/FL6Qiet.png)"},{"_id":"2cac38e78bab5e084a000011","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":1.5,"parentId":"2cab19988bab5e084a000009","content":"![](http://i.imgur.com/mJnnkvZ.png)\n##### (from SO: [Bar chart with negative values](http://stackoverflow.com/questions/10127402/bar-chart-with-negative-values))"},{"_id":"2cab5eb18bab5e084a000010","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":2,"parentId":"2cab19988bab5e084a000009","content":"![](http://i.imgur.com/PYXFEGw.png)"},{"_id":"2cafd9f312b33aee21000001","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":3,"parentId":"2cab19988bab5e084a000009","content":"Require that the delta change shouldn't be too fast at first, too slow at end (as happens with linear mapping).\n\nMapping should be like this:\n![](http://i.imgur.com/nNJy5Ia.png)"},{"_id":"2cab210a8bab5e084a00000a","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":2,"parentId":"2cab16788bab5e084a000008","content":"## Code\nThe core idea is that each meter measures the difference between how much time we've spent on an activity, and how much we should have spent so far according to the budgets.\n\n[;\\Delta_i = \\frac{t_i}{t} - \\frac{b_i}{T};]\n\nwhere [;t;] is global time elapsed, [;t_i;] is the elapsed time for activity i, [;b_i;] is the time budgeted to i, and [;T;] is the total time we're covering.\n(use [TeX the World](https://chrome.google.com/webstore/detail/tex-the-world-for-chromiu/mbfninnbhfepghkkcgdnmfmhhbjmhggn) chrome extension for Latex)\n\n**Problem** with this approach is that it requires resetting, and doesn't allow for carrying over of the surplus/deficit (which is the whole point)."},{"_id":"2caee8b81a6979e12b000007","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":0.25,"parentId":"2cab210a8bab5e084a00000a","content":"### Global variables"},{"_id":"2caee99d1a6979e12b000008","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":0.375,"parentId":"2cab210a8bab5e084a00000a","content":" t : total time elapsed\n ti[] : array of time elapsed per activity i\n bi[] : array of budget amounts per activity i\n T : total time to budget\n dt : time step"},{"_id":"2caee8761a6979e12b000006","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":0.5,"parentId":"2cab210a8bab5e084a00000a","content":"### Functions"},{"_id":"2caedf971a6979e12b000001","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":1,"parentId":"2cab210a8bab5e084a00000a","content":" tick() {\n t = t + dt;\n ti[0] = ti[0] + dt;\n //etc\n }\n"},{"_id":"2caee5421a6979e12b000003","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":2,"parentId":"2cab210a8bab5e084a00000a","content":" updateMeters() {\n setMeter(id, deltaToPercent(id));\n }"},{"_id":"2caee6481a6979e12b000004","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":3,"parentId":"2cab210a8bab5e084a00000a","content":" setMeter(id, percent) {\n //select relevant progress bars, set values\n }"},{"_id":"2caeee101a6979e12b000009","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":4,"parentId":"2cab210a8bab5e084a00000a","content":" deltaToPercent(id) {\n var x = ti[id];\n var b = bi[id];\n if( x > 0 ) {\n return 100*x/(1-b/T);\n } else {\n return 100*x*T/b;\n }\n }"},{"_id":"2cab51688bab5e084a00000c","treeId":"2cab0bca8bab5e084a000004","seq":1,"position":2,"parentId":null,"content":"### Notes\nSticking with \"weekly\" might make it tricky, and restricts the way the app can be used. How about \"Budget the next X hours\""}],"tree":{"_id":"2cab0bca8bab5e084a000004","name":"Time Budgeting App","publicUrl":"app-timebudget"}}