diff --git a/cgminer.c b/cgminer.c index 5f211b49..ca83be69 100644 --- a/cgminer.c +++ b/cgminer.c @@ -3350,6 +3350,17 @@ static void _copy_work(struct work *work, const struct work *base_work, int noff work->coinbase = strdup(base_work->coinbase); } +void set_work_ntime(struct work *work, int ntime) +{ + uint32_t *work_ntime = (uint32_t *)(work->data + 68); + + *work_ntime = htobe32(ntime); + if (work->ntime) { + free(work->ntime); + work->ntime = bin2hex((unsigned char *)work_ntime, 4); + } +} + /* Generates a copy of an existing work struct, creating fresh heap allocations * for all dynamically allocated arrays within the struct. noffset is used for * when a driver has internally rolled the ntime, noffset is a relative value. diff --git a/miner.h b/miner.h index e2b3a8ff..60c97cde 100644 --- a/miner.h +++ b/miner.h @@ -1399,6 +1399,7 @@ extern void adl(void); extern void app_restart(void); extern void clean_work(struct work *work); extern void free_work(struct work *work); +extern void set_work_ntime(struct work *work, int ntime); extern struct work *copy_work_noffset(struct work *base_work, int noffset); #define copy_work(work_in) copy_work_noffset(work_in, 0) extern struct thr_info *get_thread(int thr_id);