# 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.

## 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

### 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: ## 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).

### 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 = ti + 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;
}
}

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