Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cgminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5415,7 +5415,7 @@ static void set_curblock(const char *hexstr, const unsigned char *bedata)
int ofs;

cg_wlock(&ch_lock);
cgtime(&block_timeval);
cgtime_real(&block_timeval);
strcpy(current_hash, hexstr);
cg_memcpy(current_block, bedata, 32);
get_timestamp(blocktime, sizeof(blocktime), &block_timeval);
Expand Down Expand Up @@ -10718,10 +10718,12 @@ int main(int argc, char *argv[])
total_tv_start_sys=sInfo.uptime;
}
#endif
cgtime_real(&total_tv_start);
get_datestamp(datestamp, sizeof(datestamp), &total_tv_start);
cgtime(&total_tv_start);
cgtime(&total_tv_end);
cgtime(&tv_hashmeter);
get_datestamp(datestamp, sizeof(datestamp), &total_tv_start);
# get_datestamp(datestamp, sizeof(datestamp), &total_tv_start);

watchpool_thr_id = 2;
thr = &control_thr[watchpool_thr_id];
Expand Down
2 changes: 1 addition & 1 deletion logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void _applog(int prio, const char *str, bool force)
struct timeval tv = {0, 0};
struct tm *tm;

cgtime(&tv);
cgtime_real(&tv);

const time_t tmp_time = tv.tv_sec;
int ms = (int)(tv.tv_usec / 1000);
Expand Down
10 changes: 10 additions & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,16 @@ void cgcond_time(struct timespec *abstime)
clock_gettime(CLOCK_REALTIME, abstime);
}

/* Get CLOCK_REALTIME for display purposes */
void cgtime_real(struct timeval *tv)
{
struct timespec tp;
clock_gettime(CLOCK_REALTIME, &tp);
tv->tv_sec = tp.tv_sec;
tv->tv_usec = tp.tv_nsec / 1000;
}


#ifdef WIN32
/* Mingw32 has no strsep so create our own custom one */

Expand Down
1 change: 1 addition & 0 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ unsigned char *ser_string(char *s, int *slen);
int thr_info_create(struct thr_info *thr, pthread_attr_t *attr, void *(*start) (void *), void *arg);
void thr_info_cancel(struct thr_info *thr);
void cgcond_time(struct timespec *abstime);
void cgtime_real(struct timeval *tv);
void cgtime(struct timeval *tv);
void subtime(struct timeval *a, struct timeval *b);
void addtime(struct timeval *a, struct timeval *b);
Expand Down