Skip to content

New aggday: time interval #310

@dreeves

Description

@dreeves

Desiderata

  • Copy in Clive's proposal
  • Pick the aggday name for this
  • Spec or trial implementation

Copied from a forum post by Clive:

I was looking at clocky to measure total sleep time: I'd hoped that if I set my deadline to 14:00, then I could add a datapoint of (say) 22:00 for when I went to bed, add the next datapoint for 06:15 when I get up, and because those are logically on the same day (after the 14:00 deadline), it would faithfully report that I'd slept for 08:15 hours.

Sadly it doesn't work like that at all, it just looks for differences between the datapoints. I'm running a test goal right now, and it's not even clear to me what it's going to do for a pair of datapoints like (22:00, 06:15). They are on different physical days, but it's the same logical Beeminder day as the deadline for the goal is at 14:00, and just skimming the code I'm not sure how that cashes out.

So: can we have a nice time_interval function that actually works as one would expect here, including intervals that cross midnight (if they're on the same logical day)?

Pseudocode is something like:

  • for each time, calculate elapsed_time since deadline:
    • if time > deadline: elapsed_time = time - deadline
      else: elapsed_time = time - deadline + 24
  • take pairwise differences of these elapsed_times

Cognata

Verbata: new aggday methods,

Metadata

Metadata

Assignees

Labels

PEAEasy-peasyRFERequest For EnhancementSKYPie in the skyUVI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions