As a daily user (and enthusiast) of plain-text file formats such as markdown, ledger or todo.txt, I thought that there should also exist an equally simple way for tracking time.
After some pondering and experimenting I recently released the open-source project “klog”, which is both a file format and a command line tool. The idea is to have a lightweight syntax to record times in plain text, and to be able to run evaluations on the data.
I’m happy so far how the basic approach came out, and I’d appreciate some feedback and thoughts (especially on the file format, since that’s the central idea that everything else builds on).
For anyone interested, I have also written up some of the backstory behind the project on my blog: https://www.jotaen.net/9zRPA/klog-time-tracking-plain-textfi...
I have a question about this example:
2018-03-24
First day at my new job
8:30-17:00
-45m Lunch break
Are you in this case creating two entries, one of 8.5 hours and -45 minutes, for that date, or are you applying that -45 to the previous entry?My other comment is to strongly advise you against using whitespace for syntax, because that makes copy and paste operations much more problem-prone.
The current model is that every record (i.e. that entire block) can have multiple entries that are added up regardless of order. So the resulting total is the just the sum of the individual time values. (Here: `8h30m + (-45m) = 7h45m`)
Regarding whitespace: are you referring to some whitespace specifically (like the indentation) or to whitespace in general? Do you have a concrete idea in mind how you would change the syntax? Curious on your thoughts!
https://github.com/timpark/tasktimes (although I made the repo in 2013, I can't remember how many years earlier I started working on it)
Your format looks like a slightly more strict version of this one here: https://jeffhuang.com/productivity_text_file/
I too think that plain text is very underrated. I think though that this is more due to the tooling aspect than to the data format itself. (Especially if there is only a CLI application.) I like the note management tool Zettlr for that matter, because it demonstrates how both things can be combined.
Do you have that Perl script online somewhere? Would be curious
My thought was that there are more reasons to allow things like >24h or <0h than to reject them, but maybe it’s too much flexibility for no good reason? In any event it might be worth considering to emit a warning though, in order to prevent mistakes from happening by accident.
org-clock-in
https://orgmode.org/manual/Clocking-commands.html#Clocking-c...but i know some taskwarrior folks too.
what is new and cool here that’s a standout feature for you?
On a serious note, the main idea is to focus on time tracking (not todos) as in keeping a record of how you spent your time. The other aspect that was important to me is to put the simplicity of the file format first and to be independent from tools (when it comes to writing the data at least).
I'm especially excited about the "file format" part! Hope others can implement extra clients around this. I could imagine an android app with nextcloud/dropbox integration to sync time tracking entries between devises, e.g.
I once started (but never released) an eventful timetracker; where hooks and wrappers would (retrospectively) send events to the timetracker repo (basically just drop json files in a folder) on "events". Such as `git checkout feature/x`, git commit. Or `cd projects/foobar` or from some ical feed. Walking through these events once your manager "really really need those hours today" is always easier than retrospectively manually going through git commits, google-calendar, release-logs etc.
Seeing your project makes me want to pick that project up and make e.g. "klog.txt" files from a list of such events. Great work, and congrats on actually releasing ;)
I am indeed more focussed on the file format right now than on the command line tool. If the format turns out to be valuable and useful in itself, my plan would be to build a small UI app. As you said, I think the advantage of a well-specified plain-text file format is that tools can be built around independently – with the smallest common denominator always being the text editor of your choice.
By the way, for Mac users there is already a menu bar (systray) widget bundled in, which renders a brief overview of a file. (In a very simplistic fashion though; it’s more a proof of concept than anything else.)
<div><li class="start">202102010845</li><li class="end">202002010930</li></div>
You can argue that's ugly. And you're right, if you open it in a text editor. Thing is, you can use a browser to display it pretty darn nicely. It has all the advantages of plain text, but one massive additional advantage - you can use JS to work with the DOM to do all your queries and calculations in a few lines of code. HTML can be verbose at times, but it doesn't really matter if you use text snippets.
This is not intended to take anything away from this project. I'm just saying there's a powerful alternative that doesn't require the writing of a special processor.
There's nothing wrong with the approach you took, and there's a lot to be said for just getting stuff done, but I suspect knowing a tool for handling HTML is the reason you're using HTML as a data format rather than any specific virtue of HTML. Rather than use something 'better', you used something familiar. I see that a lot. I'd argue that you missed an opportunity to examine ways to store that specific time series data in a format that could do more stuff faster with the same level of effort, and an opportunity to learn something that is a bit more appropriate for the task.
But, ultimately, you made something that works for you, and maybe that's more important.
<dl>
<dt><time>2018-07-07 14:54:39</time> - <time>2018-07-07 17:12:05</time></dt>
<dd>Did this and that</dd>
</dl>
Native support for time ranges (e.g. through ISO8601 or a <range> element) might be coming soon in the HTML spec. Durations are already supported.For example: https://github.com/anarcat/ledger-timetracking
You can also use the aforementioned org-clock-in with it.
I'm going to write a similar one for myself. It never occurred to me that I could use a markdown file as a data files to record time against.
I keep a log of my work, inspired by .plan files, such as this, I will just tuck in the times against each day and get myself a timesheet system, thanks!
plan.md
### 2021-01-07-thu :0830-1700-45m
* fix for initdb generating wrong index causing the tests to fail and creating new c/u every run [bug]
* more fixes for tests to run reliably[1]: https://github.com/gtimelog/gtimelog/blob/master/docs/format...
The data format in timewarrior is more opaque, even though it’s still plain text of course. There are, by the way, also cool projects that use sqlite as underlying datastore, like https://github.com/samg/timetrap , which produces a similar output as timewarrior.
I guess both philosophies have different strengths and weaknesses, depending on what is important to you.
I don't have access to org mode or any third party software so it works for me.