use mySleep in CComponentsFrmClock::initClockThread(

Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
This commit is contained in:
Jacek Jendrzej
2013-12-15 17:34:53 +01:00
parent 7e2d12e5d5
commit ececd844fa
4 changed files with 13 additions and 4 deletions

View File

@@ -50,7 +50,7 @@ class CPictureViewer
COLOR=2 COLOR=2
}; };
CPictureViewer(); CPictureViewer();
~CPictureViewer(); virtual~CPictureViewer();
bool ShowImage(const std::string & filename, bool unscaled=false); bool ShowImage(const std::string & filename, bool unscaled=false);
bool DecodeImage(const std::string & name, bool showBusySign=false, bool unscaled=false); bool DecodeImage(const std::string & name, bool showBusySign=false, bool unscaled=false);
bool DisplayNextImage(); bool DisplayNextImage();

View File

@@ -37,6 +37,7 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <system/helpers.h>
using namespace std; using namespace std;
@@ -267,7 +268,7 @@ void* CComponentsFrmClock::initClockThread(void *arg)
time_t count = time(0); time_t count = time(0);
std::string format_str_save = clock->cl_format_str; std::string format_str_save = clock->cl_format_str;
//start loop for paint //start loop for paint
while(1) { while(clock != NULL) {
if (clock->paintClock) { if (clock->paintClock) {
// Blinking depending on the blink format string // Blinking depending on the blink format string
if (!clock->cl_blink_str.empty() && (clock->cl_format_str.length() == clock->cl_blink_str.length())) { if (!clock->cl_blink_str.empty() && (clock->cl_format_str.length() == clock->cl_blink_str.length())) {
@@ -286,7 +287,7 @@ void* CComponentsFrmClock::initClockThread(void *arg)
clock->cl_thread = 0; clock->cl_thread = 0;
break; break;
} }
sleep(clock->cl_interval); mySleep(clock->cl_interval);
} }
return 0; return 0;
} }

View File

@@ -42,6 +42,14 @@
#include <system/helpers.h> #include <system/helpers.h>
#include <gui/update_ext.h> #include <gui/update_ext.h>
void mySleep(int sec) {
struct timeval timeout;
timeout.tv_sec = sec;
timeout.tv_usec = 0;
select(0,0,0,0, &timeout);
}
off_t file_size(const char *filename) off_t file_size(const char *filename)
{ {
struct stat stat_buf; struct stat stat_buf;

View File

@@ -39,6 +39,7 @@ void wakeup_hdd(const char *hdd_dir);
int check_dir(const char * dir, bool allow_tmp = false); int check_dir(const char * dir, bool allow_tmp = false);
bool get_fs_usage(const char * dir, uint64_t &btotal, uint64_t &bused, long *bsize=NULL); bool get_fs_usage(const char * dir, uint64_t &btotal, uint64_t &bused, long *bsize=NULL);
bool get_mem_usage(unsigned long &total, unsigned long &free); bool get_mem_usage(unsigned long &total, unsigned long &free);
void mySleep(int sec);
std::string getPathName(std::string &path); std::string getPathName(std::string &path);
std::string getBaseName(std::string &path); std::string getBaseName(std::string &path);
@@ -64,7 +65,6 @@ class CFileHelpers
bool copyDir(const char *Src, const char *Dst, bool backupMode=false); bool copyDir(const char *Src, const char *Dst, bool backupMode=false);
bool createDir(const char *Dir, mode_t mode); bool createDir(const char *Dir, mode_t mode);
bool removeDir(const char *Dir); bool removeDir(const char *Dir);
}; };
template<class C> std::string to_string(C i) template<class C> std::string to_string(C i)