| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: time.h,v 1.61.2.3 2008/12/28 18:38:55 christos Exp $ */ | | 1 | /* $NetBSD: time.h,v 1.61.2.4 2009/01/04 04:22:10 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1982, 1986, 1993 | | 4 | * Copyright (c) 1982, 1986, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -173,27 +173,27 @@ timespec2bintime(const struct timespec * | | | @@ -173,27 +173,27 @@ timespec2bintime(const struct timespec * |
173 | { | | 173 | { |
174 | | | 174 | |
175 | bt->sec = ts->tv_sec; | | 175 | bt->sec = ts->tv_sec; |
176 | /* 18446744073 = int(2^64 / 1000000000) */ | | 176 | /* 18446744073 = int(2^64 / 1000000000) */ |
177 | bt->frac = ts->tv_nsec * (uint64_t)18446744073LL; | | 177 | bt->frac = ts->tv_nsec * (uint64_t)18446744073LL; |
178 | } | | 178 | } |
179 | | | 179 | |
180 | static __inline void | | 180 | static __inline void |
181 | bintime2timeval(const struct bintime *bt, struct timeval *tv) | | 181 | bintime2timeval(const struct bintime *bt, struct timeval *tv) |
182 | { | | 182 | { |
183 | | | 183 | |
184 | tv->tv_sec = bt->sec; | | 184 | tv->tv_sec = bt->sec; |
185 | tv->tv_usec = | | 185 | tv->tv_usec = |
186 | (long)(((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32); | | 186 | (suseconds_t)(((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32); |
187 | } | | 187 | } |
188 | | | 188 | |
189 | static __inline void | | 189 | static __inline void |
190 | timeval2bintime(const struct timeval *tv, struct bintime *bt) | | 190 | timeval2bintime(const struct timeval *tv, struct bintime *bt) |
191 | { | | 191 | { |
192 | | | 192 | |
193 | bt->sec = tv->tv_sec; | | 193 | bt->sec = tv->tv_sec; |
194 | /* 18446744073709 = int(2^64 / 1000000) */ | | 194 | /* 18446744073709 = int(2^64 / 1000000) */ |
195 | bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; | | 195 | bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; |
196 | } | | 196 | } |
197 | #endif /* !defined(_STANDALONE) */ | | 197 | #endif /* !defined(_STANDALONE) */ |
198 | | | 198 | |
199 | /* Operations on timespecs. */ | | 199 | /* Operations on timespecs. */ |