-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Elapsed Time to Timer #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me! Just need minor changes for Haiku's naming conventions.
TimerView.cpp
Outdated
@@ -5,7 +5,8 @@ | |||
TimerView::TimerView() | |||
: | |||
BTextView("timer"), | |||
fRunning(false) | |||
fRunning(false), | |||
elapsedTime(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elapsedTime(0) | |
fElapsedTime(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Haiku Coding Guidelines:
TimerView.cpp
Outdated
@@ -30,16 +31,17 @@ bool TimerView::Running() | |||
void TimerView::Stop() | |||
{ | |||
fRunning = false; | |||
elapsedTime = Elapsed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elapsedTime = Elapsed(); | |
fElapsedTime = Elapsed(); |
TimerView.cpp
Outdated
} | ||
|
||
void TimerView::Pulse() | ||
{ | ||
bigtime_t elapsed = Elapsed(); | ||
bigtime_t elapsed = fRunning ? Elapsed() : elapsedTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bigtime_t elapsed = fRunning ? Elapsed() : elapsedTime; | |
bigtime_t elapsed = fRunning ? Elapsed() : fElapsedTime; |
TimerView.h
Outdated
@@ -19,6 +19,7 @@ class TimerView : public BTextView { | |||
private: | |||
bool fRunning; | |||
bigtime_t fStartTime; | |||
int elapsedTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int elapsedTime; | |
int fElapsedTime; |
Hi! I have changed the code a little bit, since I found a simpler way to fix the issue. I was having problems with committing onto GitHub, but I recloned it and changed the code again, so now it works. Thanks! |
Thanks for making the fix even better! |
Fixes Issue #12