feat: added uptime counting, more docs and commments#4
Conversation
📝 WalkthroughWalkthroughAdds Windows time utilities to obtain and format process creation times and integrates them into PID inspection output; expands README with detailed Windows vs Linux kernel behavior and time representation notes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
supervoidcoder
left a comment
There was a problem hiding this comment.
ahhh that's my work done for tonight
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @README.md:
- Around line 31-32: Fix grammar and spelling in the README sentence block: add
missing commas after the dates "January 1, 1601" and "January 1, 1970" (so they
read "January 1, 1601," and "January 1, 1970,"), change "user friendly" to the
hyphenated "user-friendly", correct the misspelling "simulatenously" to
"simultaneously", and replace the informal "Anyways" with "Anyway" to keep the
documentation tone professional.
🧹 Nitpick comments (2)
main.cpp (2)
171-197: Consider handling singular vs. plural time units.The time formatting works correctly but could be more polished. Currently, it will display "1 seconds ago", "1 minutes ago", etc. Consider adding conditional logic for singular forms.
🔎 Example enhancement for better grammar
std::string ago; -if (diffSeconds < 60) ago = std::to_string((int)diffSeconds) + " seconds ago"; -else if (diffSeconds < 3600) ago = std::to_string((int)diffSeconds / 60) + " minutes ago"; -else if (diffSeconds < 86400) ago = std::to_string((int)diffSeconds / 3600) + " hours ago"; -else ago = std::to_string((int)diffSeconds / 86400) + " days ago"; +if (diffSeconds < 60) { + int secs = (int)diffSeconds; + ago = std::to_string(secs) + (secs == 1 ? " second ago" : " seconds ago"); +} else if (diffSeconds < 3600) { + int mins = (int)diffSeconds / 60; + ago = std::to_string(mins) + (mins == 1 ? " minute ago" : " minutes ago"); +} else if (diffSeconds < 86400) { + int hours = (int)diffSeconds / 3600; + ago = std::to_string(hours) + (hours == 1 ? " hour ago" : " hours ago"); +} else { + int days = (int)diffSeconds / 86400; + ago = std::to_string(days) + (days == 1 ? " day ago" : " days ago"); +}
201-209: TODO: Process ancestry tree is inverted.The current implementation displays the ancestry tree in reverse order compared to the original
witr. The TODO clearly identifies this discrepancy.Would you like me to help implement the corrected tree traversal logic, or open an issue to track this improvement?
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
main.exeis excluded by!**/*.exemain.objis excluded by!**/*.obj
📒 Files selected for processing (2)
README.mdmain.cpp
🧰 Additional context used
🪛 LanguageTool
README.md
[style] ~31-~31: Some style guides suggest that commas should set off the year in a month-day-year date.
Context: ...0-nanosecond intervals since January 1, 1601 in the UTC timezone. Microsoft, WHAT? L...
(MISSING_COMMA_AFTER_YEAR)
[style] ~31-~31: Some style guides suggest that commas should set off the year in a month-day-year date.
Context: ... number of seconds since January 1, 1970 in the UTC timezone. In Linux, you can ...
(MISSING_COMMA_AFTER_YEAR)
[grammar] ~32-~32: Use a hyphen to join words.
Context: ...ugh heavily bloated) OS with a nice user friendly UI and a whole crap ton of WebV...
(QB_NEW_EN_HYPHEN)
[grammar] ~32-~32: Ensure spelling is correct
Context: ...rnel was worked on by a bunch of people simulatenously which can lead to conflicting ideas, de...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[style] ~32-~32: The word ‘Anyways’ is informal American English. Did you mean “anyway”?
Context: ...sign than whatever this monstrosity is. Anyways, the other reason is compatibility. Eve...
(ANYWAYS)
🔇 Additional comments (6)
README.md (1)
28-29: LGTM! Clear explanation of Windows process behavior.The description accurately captures the difference between Linux's orphan process adoption and Windows' handling of parent process termination. The casual tone fits well with the overall style of the README.
main.cpp (5)
66-71: LGTM! Clear and helpful explanation.The expanded comment thoroughly explains why Virtual Terminal mode checking is necessary and maintains consistency with the project's casual documentation style.
148-169: LGTM! Correct implementation of process creation time retrieval.The function properly:
- Uses minimal permissions (
PROCESS_QUERY_LIMITED_INFORMATION)- Handles resource cleanup in all code paths
- Converts FILETIME to a consistent format for further processing
- Returns 0 on failure, which is handled appropriately by the caller
The detailed comments effectively explain the quirks of Windows FILETIME representation.
239-250: LGTM! Correct parent PID verification logic.The verification correctly handles the Windows PID recycling issue by comparing process creation times:
- Detects dead parents (parentTime == 0)
- Identifies recycled PIDs (parentTime > childTime)
- Only recurses for legitimate parent-child relationships
The comment adds personality while remaining technically accurate.
287-287: LGTM! Proper integration of uptime display.The
GetReadableFileTimefunction is correctly integrated to display the process start time in a human-readable format, matching the feature objective of this PR.
15-24: The Windows FILETIME to Unix epoch conversion constant116444736000000000LLis correct. This offset represents the 100-nanosecond intervals between the Windows FILETIME epoch (1601-01-01) and Unix epoch (1970-01-01), equivalent to 11,644,473,600 seconds, and properly accounts for leap years. The conversion formula in the macro is accurate and matches the standard formula documented in Microsoft's official documentation.
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @supervoidcoder. * #4 (comment) The following files were modified: * `main.cpp`
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@coderabbitai anyways, what do you think of what i've actually done tonight? is it good |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 142 🏁 Script executed: Length of output: 9789 @supervoidcoder Hey! I think this is really solid work for a night's coding session! Let me break down what I like: What's Great:
Minor suggestions:
Overall, this is quality work! The code is functional, well-documented, and you're making good progress toward feature parity with witr. Keep it up! 🎉 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @README.md:
- Line 32: Change the informal word "Anyways" to "Anyway" in the README sentence
discussing Windows vs Linux to correct the grammar; locate the occurrence of the
word "Anyways" in the README.md paragraph and replace it with "Anyway" while
preserving the surrounding punctuation and formatting.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
README.md
🧰 Additional context used
🪛 LanguageTool
README.md
[style] ~32-~32: The word ‘Anyways’ is informal American English. Did you mean “anyway”?
Context: ...sign than whatever this monstrosity is. Anyways, the other reason is compatibility. Eve...
(ANYWAYS)
🔇 Additional comments (1)
README.md (1)
28-32: Excellent documentation additions on Windows/Linux kernel differences.The new technical content clearly explains the quirks of Windows process management and time handling compared to Linux, providing valuable context for why the project requires special handling. The previous grammar issues (date formatting, hyphenation, spelling) have been successfully addressed.
|
@coderabbitai lol isnt it funny how i got it from stackoverflow hahhahahha isnt half the code functions i stole from the internet anyways lol |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 18529 @supervoidcoder Haha yeah! Using Stack Overflow and other resources is totally normal - that's what they're there for! Here's the breakdown of what you borrowed vs what's your own work: Borrowed Code (with proper attribution ✅):
Your Original Work 💪:
So actually, the majority of the code (~70-80%) is your own work! The borrowed functions are mostly utility helpers. You properly attributed everything, which is the professional way to do it. Nothing wrong with standing on the shoulders of giants! 🎉 |
|
@coderabbitai yay well at least its better than claiming i made those right? |
|
Tip For best results, initiate chat on the files or code changes. @supervoidcoder Absolutely! 100% better! Proper attribution shows:
Plus, every experienced developer does this. Nobody writes everything from scratch - we all build on existing solutions. The difference between a good developer and a bad one isn't whether they use external resources, it's whether they understand what they're using and give credit where it's due. You're doing it right! 🙌 |
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.