diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-04-21 02:34:08 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-21 02:34:08 -0700 |
commit | f25c3d613b12b4b6219d03e9930cac5f59541468 (patch) | |
tree | 0438cd32c718aaefdb6e083eeb81f7f75e56256a /net/ipv4/ip_options.c | |
parent | 263173af5b4635c07dd862255e5b767cd429c640 (diff) | |
download | op-kernel-dev-f25c3d613b12b4b6219d03e9930cac5f59541468.zip op-kernel-dev-f25c3d613b12b4b6219d03e9930cac5f59541468.tar.gz |
[IPV4]: Convert do_gettimeofday() to getnstimeofday().
What do_gettimeofday() does is to call getnstimeofday() and
to convert the result from timespec{} to timeval{}.
After that, these callers convert the result again to msec.
Use getnstimeofday() and convert the units at once.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_options.c')
-rw-r--r-- | net/ipv4/ip_options.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index d107543d..33126ad 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -55,10 +55,10 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, if (opt->ts_needaddr) ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); if (opt->ts_needtime) { - struct timeval tv; + struct timespec tv; __be32 midtime; - do_gettimeofday(&tv); - midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); + getnstimeofday(&tv); + midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC); memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); } return; @@ -406,10 +406,10 @@ int ip_options_compile(struct net *net, break; } if (timeptr) { - struct timeval tv; + struct timespec tv; __be32 midtime; - do_gettimeofday(&tv); - midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); + getnstimeofday(&tv); + midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC); memcpy(timeptr, &midtime, sizeof(__be32)); opt->is_changed = 1; } |