ithewei 6 rokov pred
rodič
commit
413fe7318e
3 zmenil súbory, kde vykonal 18 pridanie a 28 odobranie
  1. 0 3
      hplatform.h
  2. 1 21
      htime.cpp
  3. 17 4
      htime.h

+ 0 - 3
hplatform.h

@@ -120,9 +120,6 @@
 #include <math.h>
 #include <errno.h>
 #include <ctype.h>
-#include <wctype.h>
-#include <wchar.h>
-#include <uchar.h>
 
 // POSIX C
 #include <signal.h>

+ 1 - 21
htime.cpp

@@ -3,26 +3,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "hplatform.h"
-
-void msleep(unsigned long ms) {
-#ifdef OS_WIN
-    Sleep(ms);
-#else
-    usleep(ms*1000);
-#endif
-}
-
-uint64 gettick() {
-#ifdef OS_WIN
-    return GetTickCount();
-#else
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    return tv.tv_sec*1000 + tv.tv_usec/1000;
-#endif
-}
-
 datetime_t get_datetime() {
     datetime_t  dt;
 #ifdef OS_WIN
@@ -57,7 +37,7 @@ static const char* s_month[] = {"January", "February", "March", "April", "May",
     "July", "August", "September", "October", "November", "December"};
 
 int month_atoi(const char* month) {
-    for (size_t i = 0; i < ARRAY_SIZE(s_month); ++i) {
+    for (size_t i = 0; i < 12; ++i) {
         if (strnicmp(month, s_month[i], strlen(month)) == 0)
             return i+1;
     }

+ 17 - 4
htime.h

@@ -4,7 +4,6 @@
 #include <time.h>
 
 #include "hplatform.h"
-#include "hdef.h"
 
 typedef struct datetime_s {
     int year;
@@ -16,15 +15,29 @@ typedef struct datetime_s {
     int ms;
 } datetime_t;
 
-void msleep(unsigned long ms);
-
 #ifdef OS_WIN
 inline void sleep(unsigned int s) {
     Sleep(s*1000);
 }
 #endif
 
-uint64 gettick();
+inline void msleep(unsigned int ms) {
+#ifdef OS_WIN
+    Sleep(ms);
+#else
+    usleep(ms*1000);
+#endif
+}
+
+inline unsigned int gettick() {
+#ifdef OS_WIN
+    return GetTickCount();
+#else
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return tv.tv_sec*1000 + tv.tv_usec/1000;
+#endif
+}
 
 int month_atoi(const char* month);
 const char* month_itoa(int month);