1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 12:34:27 +00:00

Provide cgtimer_to_timeval helper functions.

This commit is contained in:
Con Kolivas 2013-08-19 17:44:45 +10:00
parent 09679e9f8b
commit b238139cf9
2 changed files with 11 additions and 0 deletions

10
util.c
View File

@ -817,6 +817,11 @@ void timeval_to_cgtimer(cgtimer_t *cgt, const struct timeval *tv)
{ {
timeval_to_spec(cgt, tv); timeval_to_spec(cgt, tv);
} }
void cgtimer_to_timeval(struct timeval *tv, const cgtimer_t *cgt)
{
timespec_to_val(tv, cgt);
}
#else #else
static void dtime_to_timeval(struct timeval *tv, DWORD dtime) static void dtime_to_timeval(struct timeval *tv, DWORD dtime)
{ {
@ -845,6 +850,11 @@ void timeval_to_cgtimer(cgtimer_t *cgt, const struct timeval *tv)
{ {
timeval_to_dtime(cgt, tv); timeval_to_dtime(cgt, tv);
} }
void cgtimer_to_timeval(struct timeval *tv, const cgtimer_t *cgt)
{
dtime_to_timeval(tv, *cgt);
}
#endif #endif
void subtime(struct timeval *a, struct timeval *b) void subtime(struct timeval *a, struct timeval *b)

1
util.h
View File

@ -76,6 +76,7 @@ void nmsleep(unsigned int msecs);
void nusleep(unsigned int usecs); void nusleep(unsigned int usecs);
void cgtime(struct timeval *tv); void cgtime(struct timeval *tv);
void timeval_to_cgtimer(cgtimer_t *cgt, const struct timeval *tv); void timeval_to_cgtimer(cgtimer_t *cgt, const struct timeval *tv);
void cgtimer_to_timeval(struct timeval *tv, const cgtimer_t *cgt);
void subtime(struct timeval *a, struct timeval *b); void subtime(struct timeval *a, struct timeval *b);
void addtime(struct timeval *a, struct timeval *b); void addtime(struct timeval *a, struct timeval *b);
bool time_more(struct timeval *a, struct timeval *b); bool time_more(struct timeval *a, struct timeval *b);