summaryrefslogtreecommitdiff
path: root/src/time/timr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/time/timr.cpp')
-rw-r--r--src/time/timr.cpp26
1 files changed, 25 insertions, 1 deletions
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 )
{