| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/quic_socket_utils.h" | 5 #include "net/tools/quic/quic_socket_utils.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <linux/net_tstamp.h> | 8 #include <linux/net_tstamp.h> |
| 9 #include <netinet/in.h> | 9 #include <netinet/in.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 cmsg->cmsg_type == SO_TIMESTAMPING) { | 49 cmsg->cmsg_type == SO_TIMESTAMPING) { |
| 50 LinuxTimestamping* lts = | 50 LinuxTimestamping* lts = |
| 51 reinterpret_cast<LinuxTimestamping*>(CMSG_DATA(cmsg)); | 51 reinterpret_cast<LinuxTimestamping*>(CMSG_DATA(cmsg)); |
| 52 timespec* ts = <s->systime; | 52 timespec* ts = <s->systime; |
| 53 int64_t usec = (static_cast<int64_t>(ts->tv_sec) * 1000 * 1000) + | 53 int64_t usec = (static_cast<int64_t>(ts->tv_sec) * 1000 * 1000) + |
| 54 (static_cast<int64_t>(ts->tv_nsec) / 1000); | 54 (static_cast<int64_t>(ts->tv_nsec) / 1000); |
| 55 if (latched_walltimestamps) { | 55 if (latched_walltimestamps) { |
| 56 *walltimestamp = QuicWallTime::FromUNIXMicroseconds(usec); | 56 *walltimestamp = QuicWallTime::FromUNIXMicroseconds(usec); |
| 57 } else { | 57 } else { |
| 58 *timestamp = | 58 *timestamp = |
| 59 QuicTime::Zero().Add(QuicTime::Delta::FromMicroseconds(usec)); | 59 QuicTime::Zero() + QuicTime::Delta::FromMicroseconds(usec); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr* hdr, | 67 bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr* hdr, |
| 68 QuicPacketCount* dropped_packets) { | 68 QuicPacketCount* dropped_packets) { |
| 69 if (hdr->msg_controllen > 0) { | 69 if (hdr->msg_controllen > 0) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 rc = SetGetSoftwareReceiveTimestamp(fd); | 309 rc = SetGetSoftwareReceiveTimestamp(fd); |
| 310 if (rc < 0) { | 310 if (rc < 0) { |
| 311 LOG(WARNING) << "SO_TIMESTAMPING not supported; using fallback: " | 311 LOG(WARNING) << "SO_TIMESTAMPING not supported; using fallback: " |
| 312 << strerror(errno); | 312 << strerror(errno); |
| 313 } | 313 } |
| 314 | 314 |
| 315 return fd; | 315 return fd; |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace net | 318 } // namespace net |
| OLD | NEW |