aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-04 13:03:32 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-04 13:03:32 -0800
commit5de37830adb84cf6445cc27744f256ffb5fb64d8 (patch)
tree067cc05219621697b62a1136e01f6a4ffa3f9774 /src
parent885104b2b54952ef93d209a6fa9f7614ad4bd3a2 (diff)
parentc15622b95c8162cf981aa63caf8d764ab1718b09 (diff)
Merge pull request #392 from dklempner/timeval
Remove timeval functions
Diffstat (limited to 'src')
-rw-r--r--src/core/support/time.c16
-rw-r--r--src/node/ext/timeval.cc5
2 files changed, 2 insertions, 19 deletions
diff --git a/src/core/support/time.c b/src/core/support/time.c
index 97243318fd..268a43c677 100644
--- a/src/core/support/time.c
+++ b/src/core/support/time.c
@@ -234,22 +234,6 @@ int gpr_time_similar(gpr_timespec a, gpr_timespec b, gpr_timespec threshold) {
}
}
-struct timeval gpr_timeval_from_timespec(gpr_timespec t) {
- /* TODO(klempner): Consider whether this should round up, since it is likely
- to be used for delays */
- struct timeval tv;
- tv.tv_sec = t.tv_sec;
- tv.tv_usec = t.tv_nsec / 1000;
- return tv;
-}
-
-gpr_timespec gpr_timespec_from_timeval(struct timeval t) {
- gpr_timespec ts;
- ts.tv_sec = t.tv_sec;
- ts.tv_nsec = t.tv_usec * 1000;
- return ts;
-}
-
gpr_int32 gpr_time_to_millis(gpr_timespec t) {
if (t.tv_sec >= 2147483) {
if (t.tv_sec == 2147483 && t.tv_nsec < 648 * GPR_NS_PER_MS) {
diff --git a/src/node/ext/timeval.cc b/src/node/ext/timeval.cc
index 687e33576b..20d52f0963 100644
--- a/src/node/ext/timeval.cc
+++ b/src/node/ext/timeval.cc
@@ -56,9 +56,8 @@ double TimespecToMilliseconds(gpr_timespec timespec) {
} else if (gpr_time_cmp(timespec, gpr_inf_past) == 0) {
return -std::numeric_limits<double>::infinity();
} else {
- struct timeval time = gpr_timeval_from_timespec(timespec);
- return (static_cast<double>(time.tv_sec) * 1000 +
- static_cast<double>(time.tv_usec) / 1000);
+ return (static_cast<double>(timespec.tv_sec) * 1000 +
+ static_cast<double>(timespec.tv_nsec) / 1000000);
}
}