aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/support/time.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-07-13 09:51:17 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-07-13 09:51:17 -0700
commit58bbc864badff97950bb68a64ce3ade8662bec5d (patch)
tree5196e7d7ce9ed4581a1c64f9f5e89bfc90e9bd7a /src/core/support/time.c
parent354398f9f5191bb44198b94e1828eafb60de5a67 (diff)
Updating wrapped languages to new time functions
Diffstat (limited to 'src/core/support/time.c')
-rw-r--r--src/core/support/time.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/core/support/time.c b/src/core/support/time.c
index aee64c9778..570f195bd1 100644
--- a/src/core/support/time.c
+++ b/src/core/support/time.c
@@ -99,13 +99,13 @@ gpr_timespec gpr_inf_past(gpr_clock_type type) {
/* TODO(ctiller): consider merging _nanos, _micros, _millis into a single
function for maintainability. Similarly for _seconds, _minutes, and _hours */
-gpr_timespec gpr_time_from_nanos(long ns) {
+gpr_timespec gpr_time_from_nanos(long ns, gpr_clock_type type) {
gpr_timespec result;
- result.clock_type = GPR_TIMESPAN;
+ result.clock_type = type;
if (ns == LONG_MAX) {
- result = gpr_inf_future(GPR_TIMESPAN);
+ result = gpr_inf_future(type);
} else if (ns == LONG_MIN) {
- result = gpr_inf_past(GPR_TIMESPAN);
+ result = gpr_inf_past(type);
} else if (ns >= 0) {
result.tv_sec = ns / GPR_NS_PER_SEC;
result.tv_nsec = (int)(ns - result.tv_sec * GPR_NS_PER_SEC);
@@ -117,13 +117,13 @@ gpr_timespec gpr_time_from_nanos(long ns) {
return result;
}
-gpr_timespec gpr_time_from_micros(long us) {
+gpr_timespec gpr_time_from_micros(long us, gpr_clock_type type) {
gpr_timespec result;
- result.clock_type = GPR_TIMESPAN;
+ result.clock_type = type;
if (us == LONG_MAX) {
- result = gpr_inf_future(GPR_TIMESPAN);
+ result = gpr_inf_future(type);
} else if (us == LONG_MIN) {
- result = gpr_inf_past(GPR_TIMESPAN);
+ result = gpr_inf_past(type);
} else if (us >= 0) {
result.tv_sec = us / 1000000;
result.tv_nsec = (int)((us - result.tv_sec * 1000000) * 1000);
@@ -135,13 +135,13 @@ gpr_timespec gpr_time_from_micros(long us) {
return result;
}
-gpr_timespec gpr_time_from_millis(long ms) {
+gpr_timespec gpr_time_from_millis(long ms, gpr_clock_type type) {
gpr_timespec result;
- result.clock_type = GPR_TIMESPAN;
+ result.clock_type = type;
if (ms == LONG_MAX) {
- result = gpr_inf_future(GPR_TIMESPAN);
+ result = gpr_inf_future(type);
} else if (ms == LONG_MIN) {
- result = gpr_inf_past(GPR_TIMESPAN);
+ result = gpr_inf_past(type);
} else if (ms >= 0) {
result.tv_sec = ms / 1000;
result.tv_nsec = (int)((ms - result.tv_sec * 1000) * 1000000);
@@ -153,13 +153,13 @@ gpr_timespec gpr_time_from_millis(long ms) {
return result;
}
-gpr_timespec gpr_time_from_seconds(long s) {
+gpr_timespec gpr_time_from_seconds(long s, gpr_clock_type type) {
gpr_timespec result;
- result.clock_type = GPR_TIMESPAN;
+ result.clock_type = type;
if (s == LONG_MAX) {
- result = gpr_inf_future(GPR_TIMESPAN);
+ result = gpr_inf_future(type);
} else if (s == LONG_MIN) {
- result = gpr_inf_past(GPR_TIMESPAN);
+ result = gpr_inf_past(type);
} else {
result.tv_sec = s;
result.tv_nsec = 0;
@@ -167,13 +167,13 @@ gpr_timespec gpr_time_from_seconds(long s) {
return result;
}
-gpr_timespec gpr_time_from_minutes(long m) {
+gpr_timespec gpr_time_from_minutes(long m, gpr_clock_type type) {
gpr_timespec result;
- result.clock_type = GPR_TIMESPAN;
+ result.clock_type = type;
if (m >= LONG_MAX / 60) {
- result = gpr_inf_future(GPR_TIMESPAN);
+ result = gpr_inf_future(type);
} else if (m <= LONG_MIN / 60) {
- result = gpr_inf_past(GPR_TIMESPAN);
+ result = gpr_inf_past(type);
} else {
result.tv_sec = m * 60;
result.tv_nsec = 0;
@@ -181,13 +181,13 @@ gpr_timespec gpr_time_from_minutes(long m) {
return result;
}
-gpr_timespec gpr_time_from_hours(long h) {
+gpr_timespec gpr_time_from_hours(long h, gpr_clock_type type) {
gpr_timespec result;
- result.clock_type = GPR_TIMESPAN;
+ result.clock_type = type;
if (h >= LONG_MAX / 3600) {
- result = gpr_inf_future(GPR_TIMESPAN);
+ result = gpr_inf_future(type);
} else if (h <= LONG_MIN / 3600) {
- result = gpr_inf_past(GPR_TIMESPAN);
+ result = gpr_inf_past(type);
} else {
result.tv_sec = h * 3600;
result.tv_nsec = 0;