diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libraries/LumbrJack.c | 24 | ||||
-rw-r--r-- | src/libraries/LumbrJack.h | 2 | ||||
-rw-r--r-- | src/love/love.c | 24 |
3 files changed, 26 insertions, 24 deletions
diff --git a/src/libraries/LumbrJack.c b/src/libraries/LumbrJack.c index e873d02..8d08622 100644 --- a/src/libraries/LumbrJack.c +++ b/src/libraries/LumbrJack.c | |||
@@ -86,3 +86,27 @@ char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) | |||
86 | strftime(date, DATE_TIME_LEN, "%d/%m/%Y %H:%M:%S\r", newTime); | 86 | strftime(date, DATE_TIME_LEN, "%d/%m/%Y %H:%M:%S\r", newTime); |
87 | return (dateTime); | 87 | return (dateTime); |
88 | } | 88 | } |
89 | |||
90 | float timeDiff(struct timeval *now, struct timeval *then) | ||
91 | { | ||
92 | if (0 == gettimeofday(now, 0)) | ||
93 | { | ||
94 | struct timeval thisTime = { 0, 0 }; | ||
95 | double result = 0.0; | ||
96 | |||
97 | thisTime.tv_sec = now->tv_sec; | ||
98 | thisTime.tv_usec = now->tv_usec; | ||
99 | if (thisTime.tv_usec < then->tv_usec) | ||
100 | { | ||
101 | thisTime.tv_sec--; | ||
102 | thisTime.tv_usec += 1000000; | ||
103 | } | ||
104 | thisTime.tv_usec -= then->tv_usec; | ||
105 | thisTime.tv_sec -= then->tv_sec; | ||
106 | result = ((double) thisTime.tv_usec) / ((double) 1000000.0); | ||
107 | result += thisTime.tv_sec; | ||
108 | return result; | ||
109 | } | ||
110 | else | ||
111 | return 0.0; | ||
112 | } | ||
diff --git a/src/libraries/LumbrJack.h b/src/libraries/LumbrJack.h index a096e7f..1912bef 100644 --- a/src/libraries/LumbrJack.h +++ b/src/libraries/LumbrJack.h | |||
@@ -33,5 +33,7 @@ typedef enum | |||
33 | 33 | ||
34 | int loggingStartup(char *name, int logDom); | 34 | int loggingStartup(char *name, int logDom); |
35 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); | 35 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); |
36 | float timeDiff(struct timeval *now, struct timeval *then); | ||
37 | |||
36 | 38 | ||
37 | #endif | 39 | #endif |
diff --git a/src/love/love.c b/src/love/love.c index efb686a..183e20e 100644 --- a/src/love/love.c +++ b/src/love/love.c | |||
@@ -74,30 +74,6 @@ static const char *names[] = | |||
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | static float timeDiff(struct timeval *now, struct timeval *then) | ||
78 | { | ||
79 | if (0 == gettimeofday(now, 0)) | ||
80 | { | ||
81 | struct timeval thisTime = { 0, 0 }; | ||
82 | double result = 0.0; | ||
83 | |||
84 | thisTime.tv_sec = now->tv_sec; | ||
85 | thisTime.tv_usec = now->tv_usec; | ||
86 | if (thisTime.tv_usec < then->tv_usec) | ||
87 | { | ||
88 | thisTime.tv_sec--; | ||
89 | thisTime.tv_usec += 1000000; | ||
90 | } | ||
91 | thisTime.tv_usec -= then->tv_usec; | ||
92 | thisTime.tv_sec -= then->tv_sec; | ||
93 | result = ((double) thisTime.tv_usec) / ((double) 1000000.0); | ||
94 | result += thisTime.tv_sec; | ||
95 | return result; | ||
96 | } | ||
97 | else | ||
98 | return 0.0; | ||
99 | } | ||
100 | |||
101 | static void | 77 | static void |
102 | _edje_signal_cb(void *data, Evas_Object *obj, const char *emission, const char *source) | 78 | _edje_signal_cb(void *data, Evas_Object *obj, const char *emission, const char *source) |
103 | { | 79 | { |