Introduce second-precision feature to Bartib#70
Merged
nikolassv merged 14 commits intonikolassv:masterfrom Jun 16, 2025
Merged
Conversation
…sion feature gate
…in under a minute
…ferent feature-gated versions of Bartib
…tamp precision and the actual timestamp precision
Contributor
Author
|
I have to head to bed now, but I'll be back on tomorrow to post functional test results! |
Owner
|
Thank you for your work! This is something I would have never thought of but I can understand the usecase. I hope I will be able soon to have a look at your changes and merge them. |
This reverts commit cc5327a.
Contributor
Author
|
Not sure how thorough of testing you're looking for, but here's a short clip of me using Bartib with second precision in the timestamps: compressed_bartib.mp4Let me know if there's any other functionality you want me to test :) |
Owner
|
Thanks, this looks good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR introduces a
second-precisionfeature to Bartib that allows users who compile the binary from source to record timestamps in their log file and perform report calculations with a precision of seconds instead of a precision of minutes, as is the default.Why?
I use Bartib in my
post-checkoutgit hook so I can capture the amount of time I spend on each branch over the course of the day. Sometimes, I have to flip between branches quickly. I see a lot of the following timestamps in my log file:Those logs entries effectively become "lost" minutes, if I am not mistaken. That might not seem like much, but over a period of several months using Bartib, that can amount to potentially hours worth of "lost" minutes.
How?
I didn't want to alter the default timestamp precision for all users, so I put these changes behind the feature gate
second-precisionand preserved all of the old code.Breaking changes?
The only thing that might be considered a breaking change is the changes I made to
data::parse_timepart(). I added some additional logic to detect if there is a precision mismatch. For example, in the following screenshot,bartibwas compiled without thesecond-precisionflag but has encountered a log with timestamps that have second precision:`bartib_log.txt`
I want to thank you for all of the hard work you put into this crate! This has got to be one of the best organized crates I've seen yet. I was able to make these changes in less than two hours on a single weekend - and everything worked on the first try. I know no higher honor I can given an open source maintainer than that.
Let me know if there are any changes that you'd like me to make! I'm open to feedback :)
Cheers,