summaryrefslogtreecommitdiff
path: root/drivers/unix/os_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r--drivers/unix/os_unix.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 314e13cee4..fd8c26f6d9 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -65,15 +65,25 @@ void OS_Unix::print_error(const char* p_function,const char* p_file,int p_line,c
if (!_print_error_enabled)
return;
- if (p_rationale && p_rationale[0]) {
-
- print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_rationale);
- print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line);
-
- } else {
- print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_code);
- print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line);
-
+ const char* err_details;
+ if (p_rationale && p_rationale[0])
+ err_details=p_rationale;
+ else
+ err_details=p_code;
+
+ switch(p_type) {
+ case ERR_ERROR:
+ print("\E[1;31mERROR: %s: \E[0m\E[1m%s\n",p_function,err_details);
+ print("\E[0;31m At: %s:%i.\E[0m\n",p_file,p_line);
+ break;
+ case ERR_WARNING:
+ print("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n",p_function,err_details);
+ print("\E[0;33m At: %s:%i.\E[0m\n",p_file,p_line);
+ break;
+ case ERR_SCRIPT:
+ print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n",p_function,err_details);
+ print("\E[0;35m At: %s:%i.\E[0m\n",p_file,p_line);
+ break;
}
}
@@ -226,8 +236,9 @@ uint64_t OS_Unix::get_unix_time() const {
uint64_t OS_Unix::get_system_time_msec() const {
struct timeval tv_now;
gettimeofday(&tv_now, NULL);
- localtime(&tv_now.tv_usec);
- uint64_t msec = tv_now.tv_usec/1000;
+ //localtime(&tv_now.tv_usec);
+ //localtime((const long *)&tv_now.tv_usec);
+ uint64_t msec = uint64_t(tv_now.tv_sec)*1000+tv_now.tv_usec/1000;
return msec;
}
@@ -242,7 +253,7 @@ OS::Date OS_Unix::get_date(bool utc) const {
lt=localtime(&t);
Date ret;
ret.year=1900+lt->tm_year;
- ret.month=(Month)lt->tm_mon;
+ ret.month=(Month)(lt->tm_mon + 1);
ret.day=lt->tm_mday;
ret.weekday=(Weekday)lt->tm_wday;
ret.dst=lt->tm_isdst;