Skip to content

inconsistent parsing of timeclock and timedot files complicates the use of a time budget #1908

@ghost

Description

Inconsistent parsing of timeclock and timedot files complicates the use of a budget.

  • Any value of timeclock files are parsed as hours ("h"):
# file: time.timeclock
i 2022/08/01 13:53:51 task:example
o 2022/08/03 14:29:48

i 2022/08/04 13:53:51 task:example
o 2022/08/04 14:29:48
$ hledger -f time.timeclock print
2022-08-01 * 13:53-23:59
    (task:example)          10.10h

2022-08-02 * 00:00-23:59
    (task:example)          24.00h

2022-08-03 * 00:00-14:29
    (task:example)          14.50h

2022-08-04 * 13:53-14:29
    (task:example)           0.60h
  • Any value of timedot files are parsed as numbers without "h" character:
# file: time.timeclock
2022/08/01
  task:example  10.1h

2022/08/02
  task:example  1d

2022/08/03
  task:example  14.5h

2022/08/04 *
  task:example  ...

hledger -f time.timedot print  
2022-08-01 *
    (task:example)           10.10

2022-08-02 *
    (task:example)           24.00

2022-08-03 *
    (task:example)           14.50

2022-08-04 * *
    (task:example)            0.75

So, If I want to use a budget file, I have to take into account if I am comparing with a timedot file (to define the budget values without "h") or a timeclock file (to define the budget values with "h").

# file: budget.journal
~ weekly
    (task:example)  2h
$ # bad:
$ hledger -f time.timedot -f time.timeclock -f budget.journal bal -W --budget
Budget performance in 2022-08-01W31:

              ||      2022-08-01W31 
==============++====================
 task:example || 49.35, 49.20h [2h] 
--------------++--------------------
              || 49.35, 49.20h [2h] 
$ # bad:
$ hledger -f time.timedot -f budget.journal bal -W --budget Budget performance in 2022-08-01W31:

              || 2022-08-01W31 
==============++===============
 task:example ||    49.35 [2h] 
--------------++---------------
              ||    49.35 [2h] 
$ # good:
$ hledger -f time.timeclock -f budget.journal bal -W --budget
Budget performance in 2022-08-01W31:

              ||        2022-08-01W31 
==============++======================
 task:example || 49.20h [2460% of 2h] 
--------------++----------------------
              || 49.20h [2460% of 2h] 

Two possible solutions:

  • Parse timedot values with "h" characters so timeclock, timedot and budget must use "h" values to get a valid budget report.
  • Modify the budget report to be able to convert on-the-fly times with different values (s, m, h, d...)

hledger --version
hledger 1.25, linux-x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.budgetThe balance command's --budget reporttimeclockThe timeclock file format.timedotThe timedot file format.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions