Remove mcd(4) and scd(4) remains.
[dragonfly.git] / usr.sbin / ntpd / patches / util.c.patch
1 $DragonFly: src/usr.sbin/ntpd/patches/Attic/util.c.patch,v 1.3 2005/04/14 10:31:27 joerg Exp $
2
3 --- util.c      25 Feb 2005 16:43:19 -0000      1.5
4 +++ util.c      12 Apr 2005 20:13:45 -0000
5 @@ -16,6 +16,8 @@
6   * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7   */
8  
9 +#include <sys/types.h>
10 +#include <sys/sysctl.h>
11  #include <sys/time.h>
12  #include <limits.h>
13  
14 @@ -32,6 +34,21 @@
15         return (tv.tv_sec + JAN_1970 + 1.0e-6 * tv.tv_usec);
16  }
17  
18 +double
19 +gettime_corrected(void)
20 +{
21 +       return (gettime() + getoffset());
22 +}
23 +
24 +double
25 +getoffset(void)
26 +{
27 +       int64_t offset;
28 +       size_t len = sizeof(offset);
29 +       if (sysctlbyname("kern.ntp.delta", &offset, &len, NULL, 0))
30 +               return (0.0);
31 +       return (offset * 1e-9);
32 +}
33  
34  void
35  d_to_tv(double d, struct timeval *tv)