summaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
Diffstat (limited to 'src/time')
-rw-r--r--src/time/timo.h2
-rw-r--r--src/time/timr.cpp26
-rw-r--r--src/time/timr.h5
3 files changed, 31 insertions, 2 deletions
diff --git a/src/time/timo.h b/src/time/timo.h
index ad4012e..6fd0a19 100644
--- a/src/time/timo.h
+++ b/src/time/timo.h
@@ -40,7 +40,7 @@ public:
~timo( );
double get_last_activity();
- virtual void renew_timeout();
+ void renew_timeout();
};
#endif
diff --git a/src/time/timr.cpp b/src/time/timr.cpp
index 65ba780..41555af 100644
--- a/src/time/timr.cpp
+++ b/src/time/timr.cpp
@@ -73,6 +73,11 @@ timr::start( void *v_ptr )
{
wrap::system_message( TIMERTH );
+#ifdef NCURSES
+
+ print_time( );
+#endif
+
time_t clock_start;
time_t clock_now;
@@ -94,6 +99,12 @@ timr::start( void *v_ptr )
set_time( difftime( clock_now, clock_start ),
time_now.tm_sec, time_now.tm_min, time_now.tm_hour );
+#ifdef NCURSES
+
+ if (wrap::NCUR->is_ready())
+ print_time( );
+#endif
+
// run every minute:
if ( time_now.tm_sec == 0 )
{
@@ -120,7 +131,7 @@ timr::start( void *v_ptr )
if ( time_now.tm_min % 10 == 0 )
{
- wrap::SOCK->clean_ipcache();
+ wrap::SOCK->clean_ipcache();
// Run every hour
if ( time_now.tm_min % 60 == 0 )
{
@@ -136,6 +147,19 @@ timr::start( void *v_ptr )
}
}
+#ifdef NCURSES
+void
+timr::print_time( )
+{
+ if ( !wrap::NCUR->is_ready() )
+ return;
+
+ mvprintw( NCUR_TIME_X, NCUR_TIME_Y, "Time: %s ", get_time().c_str());
+ mvprintw( NCUR_UPTIME_X, NCUR_UPTIME_Y, "Uptime: %s ", get_uptime().c_str());
+ refresh();
+}
+#endif
+
void
timr::set_time( double d_uptime, int i_cur_seconds, int i_cur_minutes, int i_cur_hours )
{
diff --git a/src/time/timr.h b/src/time/timr.h
index 0460cba..80fa2eb 100644
--- a/src/time/timr.h
+++ b/src/time/timr.h
@@ -52,6 +52,11 @@ public:
bool get_timer_active() const;
void start( void *v_ptr );
+#ifdef NCURSES
+
+ void print_time();
+#endif
+
void set_time( double d_uptime, int i_cur_seconds, int i_cur_minutes, int i_cur_hours );
string add_zero_to_front( string s_time );