aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/iomgr')
-rw-r--r--src/core/iomgr/alarm.h3
-rw-r--r--src/core/iomgr/iomgr_libevent.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/core/iomgr/alarm.h b/src/core/iomgr/alarm.h
index e09f165bcf..2bb5bf7022 100644
--- a/src/core/iomgr/alarm.h
+++ b/src/core/iomgr/alarm.h
@@ -53,7 +53,8 @@ typedef struct grpc_alarm grpc_alarm;
information about when to free up any user-level state.
Returns 1 on success, 0 on failure. */
int grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
- grpc_iomgr_cb_func alarm_cb, void *alarm_cb_arg);
+ grpc_iomgr_cb_func alarm_cb, void *alarm_cb_arg,
+ gpr_timespec now);
/* Note that there is no alarm destroy function. This is because the
alarm is a one-time occurrence with a guarantee that the callback will
diff --git a/src/core/iomgr/iomgr_libevent.c b/src/core/iomgr/iomgr_libevent.c
index 35a1764fa3..3c94d35a38 100644
--- a/src/core/iomgr/iomgr_libevent.c
+++ b/src/core/iomgr/iomgr_libevent.c
@@ -363,10 +363,11 @@ static void libevent_alarm_cb(int fd, short what, void *arg /*=alarm*/) {
}
int grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
- grpc_iomgr_cb_func alarm_cb, void *alarm_cb_arg) {
+ grpc_iomgr_cb_func alarm_cb, void *alarm_cb_arg,
+ gpr_timespec now) {
grpc_libevent_activation_data *adata =
&alarm->task.activation[GRPC_EM_TA_ONLY];
- gpr_timespec delay_timespec = gpr_time_sub(deadline, gpr_now());
+ gpr_timespec delay_timespec = gpr_time_sub(deadline, now);
struct timeval delay = gpr_timeval_from_timespec(delay_timespec);
alarm->task.type = GRPC_EM_TASK_ALARM;
gpr_atm_rel_store(&alarm->triggered, ALARM_TRIGGER_INIT);